@shzlx/ui-default 4.58.2
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/README.md +5 -0
- package/api.ts +61 -0
- package/backendlib/builder.ts +182 -0
- package/backendlib/markdown-it-imsize.ts +235 -0
- package/backendlib/markdown-it-katex.ts +139 -0
- package/backendlib/markdown-it-media.ts +163 -0
- package/backendlib/markdown-it-xss.ts +200 -0
- package/backendlib/markdown.js +64 -0
- package/backendlib/misc.ts +54 -0
- package/backendlib/template.ts +279 -0
- package/breakpoints.json +5 -0
- package/components/DOMAttachedObject.ts +128 -0
- package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
- package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
- package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
- package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
- package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
- package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
- package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
- package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
- package/components/autocomplete/index.tsx +110 -0
- package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
- package/components/autocomplete/userselectautocomplete.page.styl +6 -0
- package/components/browser-update.page.ts +27 -0
- package/components/calendar/calendar.page.styl +129 -0
- package/components/calendar/index.js +367 -0
- package/components/clipboard.page.ts +23 -0
- package/components/contest/contest.page.styl +119 -0
- package/components/contest/contest.page.ts +23 -0
- package/components/contest/contest_sidebar.page.styl +21 -0
- package/components/contest/problem-contest-bg.png +0 -0
- package/components/contest/problem-contest-bg@2x.png +0 -0
- package/components/customFont.page.tsx +90 -0
- package/components/datepicker/datepicker.page.tsx +94 -0
- package/components/dialog/DomDialog.ts +145 -0
- package/components/dialog/dialog.page.styl +40 -0
- package/components/dialog/index.tsx +285 -0
- package/components/discussion/CommentBox.js +103 -0
- package/components/discussion/collapsible.page.styl +40 -0
- package/components/discussion/collapsible.page.tsx +62 -0
- package/components/discussion/comments.page.styl +142 -0
- package/components/discussion/comments.page.tsx +192 -0
- package/components/discussion/discussion.page.styl +17 -0
- package/components/discussion/history.page.tsx +81 -0
- package/components/discussion/reaction.page.styl +30 -0
- package/components/discussion/reaction.page.tsx +103 -0
- package/components/drop/drop.page.styl +40 -0
- package/components/dropdown/Dropdown.js +50 -0
- package/components/dropdown/dropdown.page.styl +33 -0
- package/components/dropdown/dropdown.page.ts +8 -0
- package/components/editor/cmeditor.page.ts +23 -0
- package/components/editor/cmeditor.styl +10 -0
- package/components/editor/index.tsx +293 -0
- package/components/editor/mdeditor.ts +60 -0
- package/components/editor/textareaHandler.ts +29 -0
- package/components/footer/footer.page.styl +94 -0
- package/components/footer/footer.page.ts +26 -0
- package/components/form/button.page.default.styl +59 -0
- package/components/form/button.page.styl +36 -0
- package/components/form/checkbox.page.styl +89 -0
- package/components/form/form.page.styl +200 -0
- package/components/form/form.page.ts +20 -0
- package/components/form/multiSelectCheckbox.page.js +46 -0
- package/components/form/radiobox.page.styl +62 -0
- package/components/form/select.page.styl +29 -0
- package/components/form/textbox.page.styl +79 -0
- package/components/form/textbox.page.ts +21 -0
- package/components/form/var.inc.styl +14 -0
- package/components/header/header.page.styl +79 -0
- package/components/highlighter/code-example.js +111 -0
- package/components/highlighter/highlighter.page.styl +99 -0
- package/components/highlighter/highlighter.page.ts +72 -0
- package/components/highlighter/meta.js +15 -0
- package/components/highlighter/prismjs.js +122 -0
- package/components/hint.page.styl +9 -0
- package/components/hint.ts +19 -0
- package/components/hitokoto/index.page.js +21 -0
- package/components/hotkey/hotkey.page.js +83 -0
- package/components/katex/katex.page.js +26 -0
- package/components/katex/katex.page.styl +2 -0
- package/components/languageselect.tsx +94 -0
- package/components/loader/loader.page.styl +40 -0
- package/components/mantine.page.tsx +39 -0
- package/components/marker/Marker.js +192 -0
- package/components/marker/MarkerReactive.js +55 -0
- package/components/marker/marker.page.js +8 -0
- package/components/marker/marker.page.styl +57 -0
- package/components/media/media.page.js +46 -0
- package/components/menu/menu-heading.page.js +28 -0
- package/components/menu/menu.page.js +18 -0
- package/components/menu/menu.page.styl +68 -0
- package/components/message/index.page.ts +166 -0
- package/components/message/worker.ts +110 -0
- package/components/messagepad/DialogueListItem.page.styl +28 -0
- package/components/messagepad/DialogueListItemComponent.jsx +39 -0
- package/components/messagepad/Message.page.styl +64 -0
- package/components/messagepad/MessageComponent.jsx +33 -0
- package/components/messagepad/MessagePad.page.styl +99 -0
- package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
- package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
- package/components/messagepad/MessagePadInputContainer.jsx +100 -0
- package/components/messagepad/index.jsx +49 -0
- package/components/messagepad/reducers/activeId.ts +36 -0
- package/components/messagepad/reducers/dialogues.js +53 -0
- package/components/messagepad/reducers/index.ts +14 -0
- package/components/messagepad/reducers/inputs.js +43 -0
- package/components/messagepad/reducers/isPosting.ts +49 -0
- package/components/monaco/index.ts +178 -0
- package/components/monaco/languages/markdown.ts +97 -0
- package/components/monaco/languages/typescript.ts +45 -0
- package/components/monaco/languages/yaml.ts +22 -0
- package/components/monaco/loader.ts +96 -0
- package/components/monaco/monaco.styl +30 -0
- package/components/monaco/nls.js +31 -0
- package/components/monaco/schema/problemconfig.ts +123 -0
- package/components/navigation/hamburgers.page.styl +87 -0
- package/components/navigation/nav-logo-small_dark.png +0 -0
- package/components/navigation/navigation.page.js +203 -0
- package/components/navigation/navigation.page.styl +211 -0
- package/components/notification/index.ts +105 -0
- package/components/notification/notification.page.js +14 -0
- package/components/notification/notification.page.styl +84 -0
- package/components/nprogress.page.styl +50 -0
- package/components/omnisearch/index.page.tsx +124 -0
- package/components/omnisearch/omnibar.page.styl +138 -0
- package/components/pager/pager.page.styl +57 -0
- package/components/preview/preview.page.ts +187 -0
- package/components/problem/create.page.js +12 -0
- package/components/problem/list.page.js +9 -0
- package/components/problem/rp.page.styl +4 -0
- package/components/problem/tag.page.styl +84 -0
- package/components/problemconfig/BasicForm.tsx +92 -0
- package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
- package/components/problemconfig/ProblemConfigForm.tsx +140 -0
- package/components/problemconfig/ProblemConfigTree.tsx +163 -0
- package/components/problemconfig/ProblemType.tsx +165 -0
- package/components/problemconfig/index.tsx +91 -0
- package/components/problemconfig/reducer/config.ts +173 -0
- package/components/problemconfig/reducer/index.ts +11 -0
- package/components/problemconfig/reducer/testdata.ts +16 -0
- package/components/problemconfig/tree/AddTestcase.tsx +137 -0
- package/components/problemconfig/tree/SelectionManager.tsx +140 -0
- package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
- package/components/problemconfig/tree/Testcase.tsx +98 -0
- package/components/profile/backgrounds/1.jpg +0 -0
- package/components/profile/backgrounds/10.jpg +0 -0
- package/components/profile/backgrounds/11.jpg +0 -0
- package/components/profile/backgrounds/12.jpg +0 -0
- package/components/profile/backgrounds/13.jpg +0 -0
- package/components/profile/backgrounds/14.jpg +0 -0
- package/components/profile/backgrounds/15.jpg +0 -0
- package/components/profile/backgrounds/16.jpg +0 -0
- package/components/profile/backgrounds/17.jpg +0 -0
- package/components/profile/backgrounds/18.jpg +0 -0
- package/components/profile/backgrounds/19.jpg +0 -0
- package/components/profile/backgrounds/2.jpg +0 -0
- package/components/profile/backgrounds/20.jpg +0 -0
- package/components/profile/backgrounds/21.jpg +0 -0
- package/components/profile/backgrounds/3.jpg +0 -0
- package/components/profile/backgrounds/4.jpg +0 -0
- package/components/profile/backgrounds/5.jpg +0 -0
- package/components/profile/backgrounds/6.jpg +0 -0
- package/components/profile/backgrounds/7.jpg +0 -0
- package/components/profile/backgrounds/8.jpg +0 -0
- package/components/profile/backgrounds/9.jpg +0 -0
- package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
- package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
- package/components/profile/profile.page.styl +23 -0
- package/components/react/DomComponent.tsx +14 -0
- package/components/react/IconComponent.tsx +20 -0
- package/components/record/record.page.styl +26 -0
- package/components/rotator/index.js +75 -0
- package/components/rotator/rotator.page.styl +20 -0
- package/components/scratchpad/DataInput.page.styl +17 -0
- package/components/scratchpad/DataInputComponent.jsx +45 -0
- package/components/scratchpad/Editor.page.styl +13 -0
- package/components/scratchpad/Panel.page.styl +18 -0
- package/components/scratchpad/PanelButton.page.styl +15 -0
- package/components/scratchpad/PanelButtonComponent.jsx +19 -0
- package/components/scratchpad/PanelComponent.jsx +25 -0
- package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
- package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
- package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
- package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
- package/components/scratchpad/ScratchpadSettings.tsx +48 -0
- package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
- package/components/scratchpad/Tab.page.styl +24 -0
- package/components/scratchpad/Toolbar.page.styl +53 -0
- package/components/scratchpad/ToolbarComponent.jsx +85 -0
- package/components/scratchpad/index.tsx +132 -0
- package/components/scratchpad/reducers/editor.ts +24 -0
- package/components/scratchpad/reducers/index.ts +17 -0
- package/components/scratchpad/reducers/pretest.ts +34 -0
- package/components/scratchpad/reducers/records.ts +40 -0
- package/components/scratchpad/reducers/state.ts +10 -0
- package/components/scratchpad/reducers/ui.ts +152 -0
- package/components/scratchpad/scratchpad.page.styl +55 -0
- package/components/scratchpad/var.inc.styl +2 -0
- package/components/selectUser.tsx +16 -0
- package/components/signin/signInDialog.page.js +84 -0
- package/components/signin/signin_dialog.page.styl +57 -0
- package/components/smoothscroll/smoothscroll.page.js +44 -0
- package/components/socket/index.ts +68 -0
- package/components/star/star.page.styl +20 -0
- package/components/star/star.page.ts +58 -0
- package/components/sticky/sticky.page.js +66 -0
- package/components/tab/Tab.js +168 -0
- package/components/tab/tab.page.js +9 -0
- package/components/tab/tab.page.styl +105 -0
- package/components/tab/var.inc.styl +3 -0
- package/components/table/StyledTable.js +51 -0
- package/components/table/styledTable.page.js +8 -0
- package/components/table/table.page.styl +73 -0
- package/components/time/time.page.js +47 -0
- package/components/tooltip/Tooltip.js +49 -0
- package/components/tooltip/tooltip.page.js +29 -0
- package/components/tooltip/tooltip.page.styl +69 -0
- package/components/training/training.page.styl +25 -0
- package/components/upload.tsx +103 -0
- package/components/vote/vote.page.js +43 -0
- package/components/zipDownloader/index.ts +157 -0
- package/constant/domain.js +21 -0
- package/constant/message.js +5 -0
- package/constant/record.js +52 -0
- package/context.ts +11 -0
- package/entry.js +72 -0
- package/hydro.ts +112 -0
- package/index.ts +226 -0
- package/lazyload.ts +69 -0
- package/locales/en.yaml +71 -0
- package/locales/ko.yaml +823 -0
- package/locales/zh.yaml +1137 -0
- package/locales/zh_TW.yaml +1133 -0
- package/misc/Page.ts +49 -0
- package/misc/PageLoader.js +31 -0
- package/misc/float.styl +14 -0
- package/misc/grid.styl +1048 -0
- package/misc/immersive-background.jpg +0 -0
- package/misc/immersive-background@2x.jpg +0 -0
- package/misc/immersive.styl +23 -0
- package/misc/nothing.styl +13 -0
- package/misc/puzzled_twd2.svg +1 -0
- package/misc/section.styl +105 -0
- package/misc/slideout.styl +46 -0
- package/misc/structure.styl +158 -0
- package/misc/textalign.styl +11 -0
- package/misc/typography.styl +485 -0
- package/package.json +148 -0
- package/polyfill.ts +90 -0
- package/postcss.config.js +15 -0
- package/sentry.ts +26 -0
- package/service-worker.ts +265 -0
- package/setting.yaml +98 -0
- package/templates/about.html +14 -0
- package/templates/bsod.html +35 -0
- package/templates/components/comments_discussion.html +165 -0
- package/templates/components/comments_solution.html +171 -0
- package/templates/components/contest.html +12 -0
- package/templates/components/form.html +214 -0
- package/templates/components/home.html +20 -0
- package/templates/components/homework.html +8 -0
- package/templates/components/md_hint.html +39 -0
- package/templates/components/noscript_note.html +15 -0
- package/templates/components/nothing.html +6 -0
- package/templates/components/paginator.html +25 -0
- package/templates/components/problem.html +33 -0
- package/templates/components/record.html +21 -0
- package/templates/components/sidemenu.html +11 -0
- package/templates/components/user.html +49 -0
- package/templates/contest_balloon.html +48 -0
- package/templates/contest_clarification.html +103 -0
- package/templates/contest_detail.html +56 -0
- package/templates/contest_edit.html +259 -0
- package/templates/contest_main.html +146 -0
- package/templates/contest_manage.html +80 -0
- package/templates/contest_print.html +27 -0
- package/templates/contest_problemlist.html +231 -0
- package/templates/contest_scoreboard.html +46 -0
- package/templates/contest_scoreboard_download_html.html +71 -0
- package/templates/contest_user.html +47 -0
- package/templates/discussion_create.html +28 -0
- package/templates/discussion_detail.html +149 -0
- package/templates/discussion_edit.html +30 -0
- package/templates/discussion_main_or_node.html +47 -0
- package/templates/domain_base.html +26 -0
- package/templates/domain_create.html +55 -0
- package/templates/domain_dashboard.html +45 -0
- package/templates/domain_edit.html +6 -0
- package/templates/domain_group.html +51 -0
- package/templates/domain_join.html +47 -0
- package/templates/domain_join_applications.html +67 -0
- package/templates/domain_permission.html +66 -0
- package/templates/domain_role.html +71 -0
- package/templates/domain_user.html +86 -0
- package/templates/domain_user_raw.html +5 -0
- package/templates/error.html +25 -0
- package/templates/home_domain.html +64 -0
- package/templates/home_files.html +16 -0
- package/templates/home_messages.html +9 -0
- package/templates/home_security.html +224 -0
- package/templates/home_settings.html +21 -0
- package/templates/homework_detail.html +82 -0
- package/templates/homework_edit.html +138 -0
- package/templates/homework_files.html +24 -0
- package/templates/homework_main.html +76 -0
- package/templates/layout/basic.html +27 -0
- package/templates/layout/home_base.html +13 -0
- package/templates/layout/html5.html +74 -0
- package/templates/layout/immersive.html +22 -0
- package/templates/layout/mail.html +31 -0
- package/templates/layout/simple.html +4 -0
- package/templates/layout/wiki_base.html +16 -0
- package/templates/main.html +22 -0
- package/templates/manage_base.html +24 -0
- package/templates/manage_config.html +6 -0
- package/templates/manage_dashboard.html +27 -0
- package/templates/manage_script.html +56 -0
- package/templates/manage_setting.html +6 -0
- package/templates/manage_user_import.html +23 -0
- package/templates/manage_user_priv.html +76 -0
- package/templates/partials/category.html +19 -0
- package/templates/partials/contest.html +3 -0
- package/templates/partials/contest_balloon.html +37 -0
- package/templates/partials/contest_sidebar.html +150 -0
- package/templates/partials/contest_sidebar_management.html +56 -0
- package/templates/partials/contest_user.html +19 -0
- package/templates/partials/discussion_edit_form.html +45 -0
- package/templates/partials/discussion_list.html +50 -0
- package/templates/partials/discussion_nodes_widget.html +17 -0
- package/templates/partials/files.html +49 -0
- package/templates/partials/footer.html +108 -0
- package/templates/partials/hamburger.html +7 -0
- package/templates/partials/header_mobile.html +12 -0
- package/templates/partials/homepage/bulletin.html +7 -0
- package/templates/partials/homepage/contest.html +48 -0
- package/templates/partials/homepage/discussion.html +13 -0
- package/templates/partials/homepage/discussion_nodes.html +4 -0
- package/templates/partials/homepage/error.html +5 -0
- package/templates/partials/homepage/hitokoto.html +6 -0
- package/templates/partials/homepage/homework.html +45 -0
- package/templates/partials/homepage/problem_search.html +13 -0
- package/templates/partials/homepage/ranking.html +39 -0
- package/templates/partials/homepage/recent_problems.html +17 -0
- package/templates/partials/homepage/starred_problems.html +15 -0
- package/templates/partials/homepage/suggestion.html +34 -0
- package/templates/partials/homepage/training.html +50 -0
- package/templates/partials/homework.html +3 -0
- package/templates/partials/homework_default_penalty_rules.yaml +6 -0
- package/templates/partials/homework_sidebar.html +93 -0
- package/templates/partials/login_dialog.html +56 -0
- package/templates/partials/manage_user_priv.html +78 -0
- package/templates/partials/nav.html +138 -0
- package/templates/partials/problem-sidebar-information.html +25 -0
- package/templates/partials/problem.html +2 -0
- package/templates/partials/problem_category_dialog.html +43 -0
- package/templates/partials/problem_default.md +26 -0
- package/templates/partials/problem_description.html +33 -0
- package/templates/partials/problem_files.html +63 -0
- package/templates/partials/problem_list.html +68 -0
- package/templates/partials/problem_lucky.html +10 -0
- package/templates/partials/problem_sidebar.html +14 -0
- package/templates/partials/problem_sidebar_contest.html +43 -0
- package/templates/partials/problem_sidebar_homework.html +42 -0
- package/templates/partials/problem_sidebar_normal.html +152 -0
- package/templates/partials/problem_stat.html +3 -0
- package/templates/partials/scoreboard.html +79 -0
- package/templates/partials/setting.html +92 -0
- package/templates/partials/training_default.json +14 -0
- package/templates/partials/training_detail.html +153 -0
- package/templates/partials/user.html +2 -0
- package/templates/partials/user_detail/activity.html +18 -0
- package/templates/partials/user_detail/solution.html +29 -0
- package/templates/problem_config.html +39 -0
- package/templates/problem_detail.html +150 -0
- package/templates/problem_edit.html +111 -0
- package/templates/problem_files.html +91 -0
- package/templates/problem_hack.html +41 -0
- package/templates/problem_import.html +58 -0
- package/templates/problem_main.html +100 -0
- package/templates/problem_solution.html +55 -0
- package/templates/problem_statistics.html +96 -0
- package/templates/problem_submit.html +40 -0
- package/templates/ranking.html +81 -0
- package/templates/record_detail.html +134 -0
- package/templates/record_detail_status.html +93 -0
- package/templates/record_detail_summary.html +19 -0
- package/templates/record_main.html +142 -0
- package/templates/record_main_tr.html +35 -0
- package/templates/status.html +75 -0
- package/templates/training_detail.html +120 -0
- package/templates/training_edit.html +68 -0
- package/templates/training_files.html +64 -0
- package/templates/training_main.html +107 -0
- package/templates/user_changemail_mail.html +6 -0
- package/templates/user_changemail_mail_sent.html +9 -0
- package/templates/user_delete_pending.html +10 -0
- package/templates/user_detail.html +181 -0
- package/templates/user_login.html +46 -0
- package/templates/user_logout.html +13 -0
- package/templates/user_lostpass.html +27 -0
- package/templates/user_lostpass_mail.html +6 -0
- package/templates/user_lostpass_mail_sent.html +9 -0
- package/templates/user_lostpass_with_code.html +29 -0
- package/templates/user_register.html +22 -0
- package/templates/user_register_mail.html +6 -0
- package/templates/user_register_mail_sent.html +9 -0
- package/templates/user_register_with_code.html +35 -0
- package/templates/user_sudo.html +54 -0
- package/templates/user_sudo_redirect.html +18 -0
- package/templates/wiki_help.html +189 -0
- package/theme/bp6-compat.css +48 -0
- package/theme/dark.styl +397 -0
- package/theme/default.js +33 -0
- package/typed.d.ts +20 -0
- package/utils/base.ts +209 -0
- package/utils/base64.js +104 -0
- package/utils/db.ts +32 -0
- package/utils/index.ts +73 -0
- package/utils/loadReactRedux.ts +32 -0
- package/utils/mediaQuery.ts +13 -0
- package/utils/pjax.js +148 -0
- package/utils/slide.ts +57 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { CustomSelectAutoComplete } from '@hydrooj/components';
|
|
2
|
+
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
|
3
|
+
import { Button, Group, Modal, Text, TextInput } from '@mantine/core';
|
|
4
|
+
import { isEqual } from 'lodash';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
7
|
+
import { i18n } from 'vj/utils';
|
|
8
|
+
import { RootState } from '../reducer';
|
|
9
|
+
|
|
10
|
+
interface SubtaskSettingsProps {
|
|
11
|
+
subtaskIds: number[];
|
|
12
|
+
subtaskId: number;
|
|
13
|
+
time: string;
|
|
14
|
+
memory: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function SubtaskSettings(props: SubtaskSettingsProps) {
|
|
18
|
+
const [open, setOpen] = React.useState(false);
|
|
19
|
+
const [depsOpen, setDepsOpen] = React.useState(false);
|
|
20
|
+
const subtaskIds = props.subtaskIds.filter((i) => i !== props.subtaskId);
|
|
21
|
+
const score = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).score);
|
|
22
|
+
const time = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).time);
|
|
23
|
+
const memory = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).memory);
|
|
24
|
+
const deps = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).if || [], isEqual);
|
|
25
|
+
const type = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).type || 'min');
|
|
26
|
+
|
|
27
|
+
const [ctime, setTime] = React.useState(time);
|
|
28
|
+
const [cmemory, setMemory] = React.useState(memory);
|
|
29
|
+
const [cscore, setScore] = React.useState(score);
|
|
30
|
+
const [cdeps, setDeps] = React.useState(deps.join(', '));
|
|
31
|
+
const [ctype, setType] = React.useState(type);
|
|
32
|
+
|
|
33
|
+
const dispatch = useDispatch();
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
dispatch({
|
|
36
|
+
type: 'problemconfig/updateSubtaskConfig',
|
|
37
|
+
id: props.subtaskId,
|
|
38
|
+
payload: {
|
|
39
|
+
type: ctype,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}, [ctype]);
|
|
43
|
+
|
|
44
|
+
function onConfirm() {
|
|
45
|
+
dispatch({
|
|
46
|
+
type: 'problemconfig/updateSubtaskConfig',
|
|
47
|
+
id: props.subtaskId,
|
|
48
|
+
payload: {
|
|
49
|
+
time: ctime,
|
|
50
|
+
memory: cmemory,
|
|
51
|
+
score: cscore,
|
|
52
|
+
if: cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
setOpen(false);
|
|
56
|
+
setDepsOpen(false);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (<>
|
|
60
|
+
<Modal opened={open} onClose={() => setOpen(false)} title={i18n('Set time and memory limits')}>
|
|
61
|
+
<Group grow>
|
|
62
|
+
<TextInput
|
|
63
|
+
leftSection={<i className="icon icon-stopwatch" />}
|
|
64
|
+
rightSection={<Text size="sm">ms</Text>}
|
|
65
|
+
rightSectionWidth={60}
|
|
66
|
+
onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')}
|
|
67
|
+
placeholder={parseTimeMS(props.time, false).toString() || '1000'}
|
|
68
|
+
value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''}
|
|
69
|
+
/>
|
|
70
|
+
<TextInput
|
|
71
|
+
leftSection={<i className="icon icon-comparison" />}
|
|
72
|
+
rightSection={<Text size="sm">MB</Text>}
|
|
73
|
+
rightSectionWidth={60}
|
|
74
|
+
onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')}
|
|
75
|
+
placeholder={parseMemoryMB(props.memory, false).toString() || '256'}
|
|
76
|
+
value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''}
|
|
77
|
+
/>
|
|
78
|
+
<TextInput
|
|
79
|
+
leftSection={<i className="icon icon-star" />}
|
|
80
|
+
onChange={(ev) => setScore(+ev.target.value || 0)}
|
|
81
|
+
placeholder="Score"
|
|
82
|
+
type="number"
|
|
83
|
+
value={cscore.toString()}
|
|
84
|
+
/>
|
|
85
|
+
</Group>
|
|
86
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 12 }}>
|
|
87
|
+
<Button color="blue" onClick={onConfirm}>{i18n('Save')}</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</Modal>
|
|
90
|
+
<Modal opened={depsOpen} onClose={() => setDepsOpen(false)} title={i18n('Set dependencies')}>
|
|
91
|
+
<CustomSelectAutoComplete
|
|
92
|
+
data={subtaskIds.map((i) => ({ _id: i, name: `${i18n('Subtask {0}', i)}` }))}
|
|
93
|
+
setSelectItems={cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i)}
|
|
94
|
+
onChange={(items) => setDeps(items)}
|
|
95
|
+
placeholder="dependencies"
|
|
96
|
+
multi
|
|
97
|
+
/>
|
|
98
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 12 }}>
|
|
99
|
+
<Button color="blue" onClick={onConfirm}>{i18n('Save')}</Button>
|
|
100
|
+
</div>
|
|
101
|
+
</Modal>
|
|
102
|
+
<div style={{ paddingLeft: 22, display: 'flex', cursor: 'pointer', gap: 8 }} onClick={() => setOpen(true)}>
|
|
103
|
+
<Text><i className="icon icon-stopwatch" /></Text>
|
|
104
|
+
<Text className={time ? '' : 'text-gray'}>{time || props.time || '1s'} </Text>
|
|
105
|
+
<Text><i className="icon icon-comparison" /></Text>
|
|
106
|
+
<Text className={memory ? '' : 'text-gray'}>{memory || props.memory || '256m'} </Text>
|
|
107
|
+
<Text><i className="icon icon-star" /></Text>
|
|
108
|
+
<Text>{score || 0}</Text>
|
|
109
|
+
</div>
|
|
110
|
+
<div style={{ paddingLeft: 22, display: 'flex', alignItems: 'center', cursor: 'pointer', gap: 8 }} onClick={() => setDepsOpen(true)}>
|
|
111
|
+
<Text><i className="icon icon-diagram-tree" /></Text>
|
|
112
|
+
<Text>{i18n('Dependencies')}: {deps.length ? deps.join(', ') : i18n('(None)')}</Text>
|
|
113
|
+
</div>
|
|
114
|
+
<div style={{ paddingLeft: 22, display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
115
|
+
<i className="icon icon-asterisk" />
|
|
116
|
+
<Text>{i18n('Scoring method')}</Text>
|
|
117
|
+
<span style={{ marginLeft: 'auto' }}>
|
|
118
|
+
<select className="compact select" value={ctype} onChange={(e) => setType(e.target.value)}>
|
|
119
|
+
<option value="min">Min</option>
|
|
120
|
+
<option value="max">Max</option>
|
|
121
|
+
<option value="sum">Sum</option>
|
|
122
|
+
</select>
|
|
123
|
+
</span>
|
|
124
|
+
</div>
|
|
125
|
+
</>);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function GlobalSettings() {
|
|
129
|
+
const time = useSelector((s: RootState) => s.config?.time);
|
|
130
|
+
const memory = useSelector((s: RootState) => s.config?.memory);
|
|
131
|
+
const [open, setOpen] = React.useState(false);
|
|
132
|
+
const [ctime, setTime] = React.useState(time);
|
|
133
|
+
const [cmemory, setMemory] = React.useState(memory);
|
|
134
|
+
React.useEffect(() => {
|
|
135
|
+
setTime(time);
|
|
136
|
+
}, [time]);
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
setMemory(memory);
|
|
139
|
+
}, [memory]);
|
|
140
|
+
const dispatch = useDispatch();
|
|
141
|
+
function onConfirm() {
|
|
142
|
+
dispatch({
|
|
143
|
+
type: 'problemconfig/updateGlobalConfig',
|
|
144
|
+
time: ctime,
|
|
145
|
+
memory: cmemory,
|
|
146
|
+
});
|
|
147
|
+
setOpen(false);
|
|
148
|
+
}
|
|
149
|
+
return (<>
|
|
150
|
+
<Modal opened={open} onClose={() => setOpen(false)} title={i18n('Set time and memory limits')}>
|
|
151
|
+
<Group grow>
|
|
152
|
+
<TextInput
|
|
153
|
+
leftSection={<i className="icon icon-stopwatch" />}
|
|
154
|
+
rightSection={<Text size="sm">ms</Text>}
|
|
155
|
+
rightSectionWidth={60}
|
|
156
|
+
onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')}
|
|
157
|
+
placeholder="1000"
|
|
158
|
+
value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''}
|
|
159
|
+
/>
|
|
160
|
+
<TextInput
|
|
161
|
+
leftSection={<i className="icon icon-comparison" />}
|
|
162
|
+
rightSection={<Text size="sm">MB</Text>}
|
|
163
|
+
rightSectionWidth={60}
|
|
164
|
+
onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')}
|
|
165
|
+
placeholder="256"
|
|
166
|
+
value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''}
|
|
167
|
+
/>
|
|
168
|
+
</Group>
|
|
169
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 12 }}>
|
|
170
|
+
<Button color="blue" onClick={onConfirm}>{i18n('Save')}</Button>
|
|
171
|
+
</div>
|
|
172
|
+
</Modal>
|
|
173
|
+
<div style={{ paddingLeft: 22, display: 'flex', alignItems: 'center', cursor: 'pointer', gap: 8 }} onClick={() => setOpen(true)}>
|
|
174
|
+
<i className="icon icon-stopwatch" />
|
|
175
|
+
<Text className={time ? '' : 'text-gray'}>{time || '1s'}</Text>
|
|
176
|
+
<i className="icon icon-comparison" />
|
|
177
|
+
<Text className={memory ? '' : 'text-gray'}>{memory || '256MB'}</Text>
|
|
178
|
+
</div>
|
|
179
|
+
</>);
|
|
180
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TestCaseConfig } from 'hydrooj';
|
|
2
|
+
import { Text } from '@mantine/core';
|
|
3
|
+
import { omit } from 'lodash';
|
|
4
|
+
import { useContextMenu } from 'mantine-contextmenu';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { useDrag } from 'react-dnd';
|
|
7
|
+
import { useDispatch } from 'react-redux';
|
|
8
|
+
import { i18n } from 'vj/utils';
|
|
9
|
+
|
|
10
|
+
interface TestcaseNodeProps {
|
|
11
|
+
c: TestCaseConfig;
|
|
12
|
+
index: number;
|
|
13
|
+
time?: string;
|
|
14
|
+
memory?: string;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
selected: boolean;
|
|
17
|
+
subtaskId: number;
|
|
18
|
+
subtaskIds: number[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function TestcaseNode(props: TestcaseNodeProps) {
|
|
22
|
+
const {
|
|
23
|
+
c, selected, onClick, subtaskId,
|
|
24
|
+
} = props;
|
|
25
|
+
let display = `${c.input} / ${c.output}`;
|
|
26
|
+
const minlength = Math.min(c.input.length, c.output.length);
|
|
27
|
+
for (let i = minlength; i >= 0; i--) {
|
|
28
|
+
const prefix = c.input.slice(0, i);
|
|
29
|
+
if (c.input.startsWith(prefix) && c.output.startsWith(prefix)) {
|
|
30
|
+
display = `${prefix}(${c.input.substring(i)}/${c.output.substring(i)})`;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
onClick={onClick}
|
|
37
|
+
data-subtaskid={subtaskId}
|
|
38
|
+
data-index={c.input}
|
|
39
|
+
data-selected={selected}
|
|
40
|
+
style={{
|
|
41
|
+
paddingLeft: 22,
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
background: selected ? 'var(--mantine-color-blue-light, #ebf3ff)' : 'transparent',
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
fontFamily: 'var(--mantine-font-family-monospace)',
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<Text ml="xs"><i className="icon icon-file" /> {display}</Text>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface TestcaseGroupProps extends Omit<TestcaseNodeProps, 'c'> {
|
|
56
|
+
cases: TestCaseConfig[];
|
|
57
|
+
onMouseDown?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function TestcaseGroup(props: TestcaseGroupProps) {
|
|
61
|
+
const {
|
|
62
|
+
cases, subtaskId, subtaskIds, onClick, index,
|
|
63
|
+
} = props;
|
|
64
|
+
const dispatch = useDispatch();
|
|
65
|
+
const { showContextMenu } = useContextMenu();
|
|
66
|
+
const moveTargets = subtaskIds.filter((i) => i !== subtaskId);
|
|
67
|
+
const [collected, drag] = useDrag(() => ({
|
|
68
|
+
type: 'cases',
|
|
69
|
+
collect: (monitor) => ({
|
|
70
|
+
isDragging: monitor.isDragging(),
|
|
71
|
+
}),
|
|
72
|
+
canDrag: props.selected,
|
|
73
|
+
item: { cases, subtaskId },
|
|
74
|
+
}), [JSON.stringify(cases), subtaskId]);
|
|
75
|
+
return <div
|
|
76
|
+
ref={drag as any}
|
|
77
|
+
onClick={onClick}
|
|
78
|
+
onMouseDown={props.onMouseDown}
|
|
79
|
+
onContextMenu={showContextMenu(
|
|
80
|
+
moveTargets.length
|
|
81
|
+
? moveTargets.map((id) => ({
|
|
82
|
+
key: `move-${id}`,
|
|
83
|
+
icon: <i className="icon icon-send" />,
|
|
84
|
+
title: `${i18n('Move to')} ${i18n('Subtask {0}', id)}`,
|
|
85
|
+
onClick: () => dispatch({
|
|
86
|
+
type: 'problemconfig/moveTestcases',
|
|
87
|
+
payload: { target: id, source: subtaskId, cases },
|
|
88
|
+
}),
|
|
89
|
+
}))
|
|
90
|
+
: [{ key: 'no-target', title: i18n('No target available'), onClick: () => { }, disabled: true }],
|
|
91
|
+
)}
|
|
92
|
+
style={{ opacity: collected.isDragging ? 0.5 : 1 }}
|
|
93
|
+
>
|
|
94
|
+
{cases.map((c, id) => (
|
|
95
|
+
<TestcaseNode c={c} key={`${c.input}@${index + id}`} {...omit(props, 'onClick')} index={index + id} />
|
|
96
|
+
))}
|
|
97
|
+
</div>;
|
|
98
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.user-profile-avatar
|
|
2
|
+
border-radius: 50% !important
|
|
3
|
+
|
|
4
|
+
.user-profile-badge
|
|
5
|
+
display: inline-block !important
|
|
6
|
+
font-size: rem(12px) !important
|
|
7
|
+
padding: rem(3px 4px) !important
|
|
8
|
+
line-height: 1 !important
|
|
9
|
+
|
|
10
|
+
&:hover
|
|
11
|
+
text-decoration: none !important
|
|
12
|
+
|
|
13
|
+
for n in (1..21)
|
|
14
|
+
.user-profile-bg--{n}
|
|
15
|
+
background-image: url('backgrounds/' + n + '.jpg')
|
|
16
|
+
|
|
17
|
+
.user-profile-bg--thumbnail-{n}
|
|
18
|
+
background-image: url('backgrounds/thumbnail/' + n + '.jpg')
|
|
19
|
+
|
|
20
|
+
for key, _ in $badge-bg-color
|
|
21
|
+
.badge--{key}
|
|
22
|
+
background-color: $badge-bg-color[key] !important
|
|
23
|
+
color: $badge-text-color[key] !important
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import { omit } from 'lodash';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement }) {
|
|
6
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
ref.current.appendChild(props.childDom);
|
|
9
|
+
return () => {
|
|
10
|
+
$(ref.current).empty();
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export default function IconComponent(props: { name: string, className?: string } & React.HTMLAttributes<HTMLSpanElement>) {
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
className,
|
|
9
|
+
...rest
|
|
10
|
+
} = props;
|
|
11
|
+
const cn = classNames(className, `icon icon-${name}`);
|
|
12
|
+
return (
|
|
13
|
+
<span {...rest} className={cn} />
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
IconComponent.propTypes = {
|
|
18
|
+
name: PropTypes.string.isRequired,
|
|
19
|
+
className: PropTypes.string,
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.record-status--text
|
|
2
|
+
for key, value in $record-status-color
|
|
3
|
+
&.{key}
|
|
4
|
+
color: value !important
|
|
5
|
+
|
|
6
|
+
.record-status--icon
|
|
7
|
+
display: inline-block
|
|
8
|
+
width: 1.15em
|
|
9
|
+
for key, value in $record-status-icon
|
|
10
|
+
&.{key}:before
|
|
11
|
+
content: value
|
|
12
|
+
color: $record-status-color[key]
|
|
13
|
+
|
|
14
|
+
.record-status--border
|
|
15
|
+
border-left: rem(3px) solid transparent
|
|
16
|
+
for key, value in $record-status-color
|
|
17
|
+
&.{key}
|
|
18
|
+
border-left: rem(3px) solid lighten(value, 10%)
|
|
19
|
+
|
|
20
|
+
.record-status--background
|
|
21
|
+
color: #FFF
|
|
22
|
+
|
|
23
|
+
for key, value in $record-status-color
|
|
24
|
+
&.{key}
|
|
25
|
+
background: value
|
|
26
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
|
3
|
+
import { delay } from 'vj/utils';
|
|
4
|
+
|
|
5
|
+
const ANIMATION_DURATION = 4000;
|
|
6
|
+
|
|
7
|
+
const POS_ABOVE = -1;
|
|
8
|
+
const POS_ORIGINAL = 0;
|
|
9
|
+
const POS_BELOW = 1;
|
|
10
|
+
|
|
11
|
+
const POS_CLASSNAME = {
|
|
12
|
+
[POS_ABOVE]: 'pos--above',
|
|
13
|
+
[POS_ORIGINAL]: '',
|
|
14
|
+
[POS_BELOW]: 'pos--below',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default class Rotator extends DOMAttachedObject {
|
|
18
|
+
static DOMAttachKey = 'vjRotatorInstance';
|
|
19
|
+
|
|
20
|
+
getItemClass(pos) {
|
|
21
|
+
return `rotator__item ${POS_CLASSNAME[pos]}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor($dom) {
|
|
25
|
+
super($dom);
|
|
26
|
+
$dom.addClass('rotator');
|
|
27
|
+
this.value = $dom.text();
|
|
28
|
+
this.$item = this
|
|
29
|
+
.createItem(this.value, POS_ORIGINAL)
|
|
30
|
+
.appendTo($dom.empty());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
createItem(value, initialPosition) {
|
|
34
|
+
const $el = $('<div>')
|
|
35
|
+
.text(value)
|
|
36
|
+
.attr('class', this.getItemClass(initialPosition));
|
|
37
|
+
return $el;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async animateOutItem(toPosition) {
|
|
41
|
+
const { $item } = this;
|
|
42
|
+
$item.attr('class', this.getItemClass(toPosition));
|
|
43
|
+
await delay(ANIMATION_DURATION);
|
|
44
|
+
$item.remove();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async animateInItem() {
|
|
48
|
+
const { $item } = this;
|
|
49
|
+
$item.height(); // force reflow
|
|
50
|
+
$item.attr('class', this.getItemClass(POS_ORIGINAL));
|
|
51
|
+
await delay(ANIMATION_DURATION);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setValue(value) {
|
|
55
|
+
if (value === this.value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let fromPosition;
|
|
59
|
+
if (Number.parseFloat(value) > Number.parseFloat(this.value)) {
|
|
60
|
+
fromPosition = POS_BELOW;
|
|
61
|
+
} else {
|
|
62
|
+
fromPosition = POS_ABOVE;
|
|
63
|
+
}
|
|
64
|
+
this.animateOutItem(-fromPosition);
|
|
65
|
+
this.value = value;
|
|
66
|
+
this.$item = this
|
|
67
|
+
.createItem(value, fromPosition)
|
|
68
|
+
.appendTo(this.$dom);
|
|
69
|
+
this.animateInItem();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getValue() {
|
|
73
|
+
return this.value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.rotator
|
|
2
|
+
position: relative
|
|
3
|
+
height: 1em
|
|
4
|
+
|
|
5
|
+
.rotator__item
|
|
6
|
+
position: absolute
|
|
7
|
+
left: 0
|
|
8
|
+
top: 0
|
|
9
|
+
width: 100%
|
|
10
|
+
height: 100%
|
|
11
|
+
transition: transform .2s, opacity .2s
|
|
12
|
+
transition-timing-function: ease-out-cubic
|
|
13
|
+
|
|
14
|
+
&.pos--above
|
|
15
|
+
transform: translateY(-100%)
|
|
16
|
+
opacity: 0
|
|
17
|
+
|
|
18
|
+
&.pos--below
|
|
19
|
+
transform: translateY(100%)
|
|
20
|
+
opacity: 0
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.scratchpad__data-input
|
|
2
|
+
border: 0
|
|
3
|
+
border-left: 3px solid #E0E0E0
|
|
4
|
+
background: #F8F8F8
|
|
5
|
+
padding: rem(8px 4px)
|
|
6
|
+
font-family: $code-font-family
|
|
7
|
+
font-size: rem($font-size-secondary)
|
|
8
|
+
outline: 0
|
|
9
|
+
resize: none
|
|
10
|
+
color: #666
|
|
11
|
+
height: 100%
|
|
12
|
+
width: 100%
|
|
13
|
+
transition: background-color .2s linear, border-color .2s linear
|
|
14
|
+
|
|
15
|
+
&:focus
|
|
16
|
+
background: #FFF
|
|
17
|
+
border-color: lighten($primary-color, 70%)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
|
|
3
|
+
export default function DataInputComponent(props) {
|
|
4
|
+
const {
|
|
5
|
+
html,
|
|
6
|
+
title,
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
className,
|
|
10
|
+
...rest
|
|
11
|
+
} = props;
|
|
12
|
+
return (
|
|
13
|
+
<div {...rest} className={className} style={{ height: '100%', width: '100%' }}>
|
|
14
|
+
{html ? (
|
|
15
|
+
<div
|
|
16
|
+
className="scratchpad__data-input"
|
|
17
|
+
style={{ overflowY: 'scroll' }}
|
|
18
|
+
wrap="off"
|
|
19
|
+
spellCheck="false"
|
|
20
|
+
>
|
|
21
|
+
<pre dangerouslySetInnerHTML={{ __html: value }} contentEditable />
|
|
22
|
+
</div>
|
|
23
|
+
) : (
|
|
24
|
+
<textarea
|
|
25
|
+
className="scratchpad__data-input"
|
|
26
|
+
wrap="off"
|
|
27
|
+
spellCheck="false"
|
|
28
|
+
value={value}
|
|
29
|
+
onChange={(ev) => {
|
|
30
|
+
ev.stopPropagation();
|
|
31
|
+
onChange(ev.target.value);
|
|
32
|
+
}}
|
|
33
|
+
placeholder={title}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
DataInputComponent.propTypes = {
|
|
41
|
+
title: PropTypes.node,
|
|
42
|
+
value: PropTypes.string,
|
|
43
|
+
onChange: PropTypes.func,
|
|
44
|
+
className: PropTypes.string,
|
|
45
|
+
};
|