From 80a7bd1f707ecac14aa95cfc2162a2f8a370c952 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Wed, 9 Dec 2020 16:42:53 +0900 Subject: [PATCH 001/101] add: set .gitignore and eslint --- .eslintrc.js | 15 + .gitignore | 151 +++++ package-lock.json | 1522 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 24 + 4 files changed, 1712 insertions(+) create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..01c7fd7fd --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,15 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: [ + 'airbnb-base', + ], + parserOptions: { + ecmaVersion: 12, + sourceType: 'module', + }, + rules: { + }, +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..37944d1df --- /dev/null +++ b/.gitignore @@ -0,0 +1,151 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos,node,vscode +# Edit at https://www.toptal.com/developers/gitignore?templates=macos,node,vscode + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env*.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +### vscode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# End of https://www.toptal.com/developers/gitignore/api/macos,node,vscode diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..43c5df79f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1522 @@ +{ + "name": "javascript-subway-map-precourse", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } + } + }, + "@eslint/eslintrc": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.2.tgz", + "integrity": "sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + } + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-includes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.2.tgz", + "integrity": "sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "get-intrinsic": "^1.0.1", + "is-string": "^1.0.5" + } + }, + "array.prototype.flat": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + } + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "call-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", + "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "confusing-browser-globals": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", + "dev": true + }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.15.0.tgz", + "integrity": "sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.2.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^6.0.0", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-config-airbnb-base": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", + "dev": true, + "requires": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", + "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-module-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "requires": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", + "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.3.1.tgz", + "integrity": "sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "file-entry-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", + "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz", + "integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-intrinsic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", + "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "requires": { + "type-fest": "^0.8.1" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.2.tgz", + "integrity": "sha512-cTPNrlvJT6twpYy+YmKUKrTSjWFs3bjYjAhCwm+z4EOCubZxAuO+hHpRN64TqjEaYSHs7tJAE0w1CKMGmsG/lw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-callable": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "dev": true + }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true + }, + "is-regex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.entries": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.3.tgz", + "integrity": "sha512-ym7h7OZebNS96hn5IJeyUmaWhaSM4SVtAPPfNLQEI2MYWCO2egsITb9nab2+i/Pwibx+R0mtn+ltKJXRSeTMGg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "has": "^1.0.3" + } + }, + "object.values": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz", + "integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "has": "^1.0.3" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + } + }, + "regexpp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", + "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "dev": true + }, + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + } + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "string.prototype.trimend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", + "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", + "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + }, + "uri-js": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", + "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-compile-cache": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", + "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..1f229c938 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "javascript-subway-map-precourse", + "version": "1.0.0", + "description": "WooWa_course season 3, last mission ", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sunhpark42/javascript-subway-map-precourse.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/sunhpark42/javascript-subway-map-precourse/issues" + }, + "homepage": "https://github.com/sunhpark42/javascript-subway-map-precourse#readme", + "devDependencies": { + "eslint": "^7.15.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.22.1" + } +} From 6776e4a3029e0a904f83573b13d078bceebb71a7 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Wed, 9 Dec 2020 16:51:37 +0900 Subject: [PATCH 002/101] docs: create README.md --- docs/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..36b3f4017 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,28 @@ +# πŸš‡ μ§€ν•˜μ²  노선도 λ―Έμ…˜ + +## πŸ“„ λ―Έμ…˜ μ†Œκ°œ +μ§€ν•˜μ²  μ—­, λ…Έμ„ , ꡬ간을 관리 ν•˜κ³  μ‘°νšŒν•˜λŠ” μ„œλΉ„μŠ€ + +## βš™οΈ μ‹€ν–‰ 방법 +1. `git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git` +2. `git checkout sunhpark42` +3. `npx http-server` + +## πŸ’» 개발 +### κ°œλ°œκΈ°κ°„ + * 2020.12.02 - 2020.12.08 +### μ‚¬μš© μ–Έμ–΄ +

+ + +

+ +## βš’ κΈ°λŠ₯ λͺ…μ„Έ + +## βœ”οΈ 컀밋 κ·œμΉ™ +* feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ +* fix : 버그 μˆ˜μ • +* docs : λ¬Έμ„œμ˜ μˆ˜μ • +* style : μ½”λ“œμ˜ μˆ˜μ • 없이 μŠ€νƒ€μΌλ§Œ λ³€κ²½ +* refactor : μ½”λ“œλ₯Ό λ¦¬νŽ™ν† λ§ +* test : Test κ΄€λ ¨ν•œ μ½”λ“œμ˜ μΆ”κ°€, μˆ˜μ • \ No newline at end of file From 39bae5976d5ce517194c84126cfa1aca3963900c Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Wed, 9 Dec 2020 16:57:56 +0900 Subject: [PATCH 003/101] docs: update README.md --- docs/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 36b3f4017..ba7d190ae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,13 +4,12 @@ μ§€ν•˜μ²  μ—­, λ…Έμ„ , ꡬ간을 관리 ν•˜κ³  μ‘°νšŒν•˜λŠ” μ„œλΉ„μŠ€ ## βš™οΈ μ‹€ν–‰ 방법 -1. `git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git` -2. `git checkout sunhpark42` -3. `npx http-server` +```git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd javascript-subway-map-precourse; git checkout sunhpark42; npx http-server``` +* λ§Œμ•½ http-server κ°€ μ—†λ‹€λ©΄ `npm install http-server`λ₯Ό μ„€μΉ˜ν•˜κ³  재 μ‹œν–‰. ## πŸ’» 개발 ### κ°œλ°œκΈ°κ°„ - * 2020.12.02 - 2020.12.08 + * 2020.12.09 - 2020.12.15 ### μ‚¬μš© μ–Έμ–΄

From 1820754e63072eca5bda676ddbfbd47f531cc810 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Wed, 9 Dec 2020 17:00:11 +0900 Subject: [PATCH 004/101] docs: update README.md --- docs/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index ba7d190ae..7a870d9f2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,9 @@ μ§€ν•˜μ²  μ—­, λ…Έμ„ , ꡬ간을 관리 ν•˜κ³  μ‘°νšŒν•˜λŠ” μ„œλΉ„μŠ€ ## βš™οΈ μ‹€ν–‰ 방법 -```git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd javascript-subway-map-precourse; git checkout sunhpark42; npx http-server``` +``` +git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd javascript-subway-map-precourse; git checkout sunhpark42; npx http-server +``` * λ§Œμ•½ http-server κ°€ μ—†λ‹€λ©΄ `npm install http-server`λ₯Ό μ„€μΉ˜ν•˜κ³  재 μ‹œν–‰. ## πŸ’» 개발 From cfda41c9ffc0995ef57a181347e4a19fbc35c6a2 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 02:28:04 +0900 Subject: [PATCH 005/101] docs: update README.md --- docs/README.md | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/docs/README.md b/docs/README.md index 7a870d9f2..b39a01fc9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,6 +19,100 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd

## βš’ κΈ°λŠ₯ λͺ…μ„Έ +### 메뉴 +1. 이벀트 관리 + * '1. μ—­ 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + * '2. λ…Έμ„  관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + * '3. ꡬ간 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ꡬ간 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + * '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. +2. ν™”λ©΄ ν‘œμ‹œ + * μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + * λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + * ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + * μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + +### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ +1. 이벀트 관리 (Controller) + * 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. +2. ν™”λ©΄ ν‘œμ‹œ (View) + * 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) + * μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + * μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + * 확인 및 μ·¨μ†Œ λ²„νŠΌ +3. μ£Όμš” κΈ°λŠ₯ (Model) + * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + * μ˜ˆμ™Έ 처리 + 1. μ—­ 이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬. + 2. μ—­ 이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. + 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) + 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ + * μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. + * κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + * μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + * 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + * 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + +### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ +1. 이벀트 관리 (Controller) + * 'λ…Έμ„  μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  λͺ©λ‘ 좔가와, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή λ…Έμ„  μ‚­μ œμ™€, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. +2. ν™”λ©΄ ν‘œμ‹œ (View) + * 전체 화면을 ν‘œμ‹œν•œλ‹€. (λ…Έμ„  μž…λ ₯ 및 λ…Έμ„  λͺ©λ‘) + * λ…Έμ„  μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + * λ…Έμ„  λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + * 확인 및 μ·¨μ†Œ λ²„νŠΌ +3. μ£Όμš” κΈ°λŠ₯ (Model) + * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ λ…Έμ„  이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + * μ˜ˆμ™Έ 처리 + 1. λ…Έμ„  이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 2. λ…Έμ„  이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 3. λ…Έμ„  이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 4. λ…Έμ„  이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ (ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) + 5. λ…Έμ„  이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 6. λ…Έμ„  이름이 'μ„ '으둜 λλ‚˜μ§€ μ•ŠλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ (λ…Έμ„  μž„μ„ ν‘œμ‹œν•˜κΈ° μœ„ν•¨) + * μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. + * κΈ°μ‘΄ λ…Έμ„  λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + * 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) + * 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + * 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + +### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ +1. 이벀트 관리 (Controller) + * 각 'λ…Έμ„ ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ν•΄λ‹Ή λ…Έμ„  관리 화면을 λ„μ›Œμ€„ 것을 μš”μ²­ν•œλ‹€. + * λ…Έμ„  관리 ν™”λ©΄μ—μ„œ '등둝' λ²„νŠΌμ„ 클릭할 경우 ꡬ간 λͺ©λ‘ 좔가와, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * λ…Έμ„  관리 ν™”λ©΄μ—μ„œ 'λ…Έμ„ μ—μ„œ 제거' λ²„νŠΌμ„ 클릭할 경우 μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή ꡬ간 μ‚­μ œμ™€, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ ꡬ간 μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. +2. ν™”λ©΄ ν‘œμ‹œ (View) + * μˆ˜μ •ν•  λ…Έμ„  화면을 ν‘œμ‹œν•œλ‹€. + * λ…Έμ„  관리 화면을 ν‘œμ‹œν•œλ‹€. + * λ…Έμ„  관리 화면을 κ°±μ‹ ν•œλ‹€. + * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + * 확인 및 μ·¨μ†Œ λ²„νŠΌ μΆ”κ°€ +3. μ£Όμš” κΈ°λŠ₯ (Model) + * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μˆœμ„œ 값이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + * μ˜ˆμ™Έ 처리 + 1. μˆœμ„œκ°€ 음수인 경우 μ˜ˆμ™Έμ²˜λ¦¬ + 2. μˆœμ„œκ°€ μˆ«μžκ°€ μ•„λ‹Œ 경우 μ˜ˆμ™Έμ²˜λ¦¬ + * κΈ°μ‘΄ 노선에 μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€.(μ€‘λ³΅λœ 이름이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬) + * 노선에 ν¬ν•¨λœ 역이 λ‘κ°œ μ΄ν•˜μΈμ§€ ν™•μΈν•œλ‹€. + * 노선에 역을 μΆ”κ°€ν•œλ‹€. + * λ…Έμ„ μ—μ„œ 역을 μ‚­μ œν•œλ‹€. + +### μ§€ν•˜μ²  노선도 관리 κΈ°λŠ₯ +1. ν™”λ©΄ν‘œμ‹œ (View) + * μ—­ λͺ©λ‘μ„ 좜λ ₯ν•œλ‹€. ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ From 98d46b3e997050d35ac47c0b2ab1d169d18e8546 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 02:42:55 +0900 Subject: [PATCH 006/101] feat: create MenuView module --- src/Menu/MenuView.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/Menu/MenuView.js diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js new file mode 100644 index 000000000..e69de29bb From fc816c4b4a4fc9fbfb17815357c45771fdd04546 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 03:35:03 +0900 Subject: [PATCH 007/101] feat: add Menu Buttons on top --- src/Menu/MenuView.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index e69de29bb..bc5a00f09 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -0,0 +1,23 @@ +export default class MenuView { + static MenuButtonListView() { + document.getElementById('app').innerHTML += ` + + + + + `; + } + + StationManagerView() { + + } + LineManagerView() { + + } + SectionManagerView() { + + } + MapPrintManagerView() { + + } +} \ No newline at end of file From 7f57434883d7001b46788ac8f9c43a7dadd9e716 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 03:36:54 +0900 Subject: [PATCH 008/101] feat: add div in MenuBottonList for subview --- src/Menu/MenuView.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index bc5a00f09..14666b67f 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -5,6 +5,7 @@ export default class MenuView { +
`; } From 85f273743ac25de31e37b00a197a2688454dbd7c Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 03:39:14 +0900 Subject: [PATCH 009/101] feat: add Station Manager subView under Menus --- src/Menu/MenuView.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 14666b67f..bf0bff6fd 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -9,9 +9,27 @@ export default class MenuView { `; } - StationManagerView() { - + static StationManagerView() { + document.getElementById('sub-view-container').innerHTML = ` +

μ—­ 이름

+
+ + +
+

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

+ + + + + + + + + +
μ—­ 이름섀정
hello
+ `; } + LineManagerView() { } From d78a2f2cabf7ac7748349472f4fbcb43f7a72467 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 03:40:29 +0900 Subject: [PATCH 010/101] feat: add placeholder to Station Name Input Form --- src/Menu/MenuView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index bf0bff6fd..a5467091c 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -13,7 +13,7 @@ export default class MenuView { document.getElementById('sub-view-container').innerHTML = `

μ—­ 이름

- +

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

From caf32b963e70ce0d86ffc64523e5474550bbb330 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 03:45:54 +0900 Subject: [PATCH 011/101] feat: add LineMangerView --- src/Menu/MenuView.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index a5467091c..6e52cc2eb 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -30,8 +30,27 @@ export default class MenuView { `; } - LineManagerView() { - + static LineManagerView() { + document.getElementById('sub-view-container').innerHTML = ` +

λ…Έμ„  이름

+ + +

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

+ + + + + + + + + + + + + +
λ…Έμ„  이름상행 μ’…μ μ—­ν•˜ν–‰ 쒅점역섀정
1ν˜Έμ„ μΈμ²œμ†Œμš”μ‚°
+ `; } SectionManagerView() { From 4e900402159925ef34e7eacb572f060bc94f03c6 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:00:51 +0900 Subject: [PATCH 012/101] feat: add selectBox for North, South bound lane to LineManagerView --- src/Menu/MenuView.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 6e52cc2eb..7d8f67a6e 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -12,12 +12,10 @@ export default class MenuView { static StationManagerView() { document.getElementById('sub-view-container').innerHTML = `

μ—­ 이름

-
- - -
+ +

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

- +
@@ -34,6 +32,20 @@ export default class MenuView { document.getElementById('sub-view-container').innerHTML = `

λ…Έμ„  이름

+

상행 쒅점 + +

+

ν•˜ν–‰ 쒅점 + +

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

μ—­ 이름 μ„€μ •
From 544b08db1dae226e0239ccf57dc91d3dcca6d421 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:17:07 +0900 Subject: [PATCH 013/101] feat: add SectionManagerView method --- src/Menu/MenuView.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 7d8f67a6e..a3f51318e 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -64,9 +64,42 @@ export default class MenuView {
`; } - SectionManagerView() { + static SectionManagerView() { + document.getElementById('sub-view-container').innerHTML = ` +

ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

+ + + + + `; } + MapPrintManagerView() { } From 421d183e1e0f5bc3ff66e9de4c051789a44df19f Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:20:14 +0900 Subject: [PATCH 014/101] feat: add MapPrintManagerView method --- src/Menu/MenuView.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index a3f51318e..5d5c02bb0 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -100,7 +100,18 @@ export default class MenuView { `; } - MapPrintManagerView() { - + static MapPrintManagerView() { + document.getElementById('sub-view-container').innerHTML = ` +

1ν˜Έμ„ 

+
    +
  • 인천
  • +
  • μ†Œμš”μ‚°
  • +
+

2ν˜Έμ„ 

+
    +
  • μ‹œμ²­
  • +
  • 신도림
  • +
+ `; } -} \ No newline at end of file +} From c31e5c4bfb958447d0a89ca68b98dc1acd4626fc Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:33:27 +0900 Subject: [PATCH 015/101] feat: create MenuController for Menu Button Click events --- src/Menu/MenuController.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/Menu/MenuController.js diff --git a/src/Menu/MenuController.js b/src/Menu/MenuController.js new file mode 100644 index 000000000..316180aea --- /dev/null +++ b/src/Menu/MenuController.js @@ -0,0 +1,21 @@ +import MenuView from './MenuView.js'; + +export default class MenuController { + static ButtonEventController() { + document.addEventListener('click', (event) => { + const eventId = event.target.id; + if (eventId === 'station-manager-button') { + MenuView.StationManagerView(); + } + if (eventId === 'line-manager-button') { + MenuView.LineManagerView(); + } + if (eventId === 'section-manager-button') { + MenuView.SectionManagerView(); + } + if (eventId === 'map-print-manager-button') { + MenuView.MapPrintManagerView(); + } + }); + } +} From efec48c55774861398c3d042ab02ec9a54d982ed Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:39:29 +0900 Subject: [PATCH 016/101] docs: update README.md --- docs/README.md | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/README.md b/docs/README.md index b39a01fc9..485cafab4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,42 +21,42 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ## βš’ κΈ°λŠ₯ λͺ…μ„Έ ### 메뉴 1. 이벀트 관리 - * '1. μ—­ 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. - * '2. λ…Έμ„  관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. - * '3. ꡬ간 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ꡬ간 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. - * '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. + - [x] '1. μ—­ 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + - [x] '2. λ…Έμ„  관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + - [x] '3. ꡬ간 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ꡬ간 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. + - [x] '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ - * μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - * λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - * ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - * μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. ### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - * 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - * 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - * μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - * μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. - * 확인 및 μ·¨μ†Œ λ²„νŠΌ + - 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) + - μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + - μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + - μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - * μ˜ˆμ™Έ 처리 + - μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + - μ˜ˆμ™Έ 처리 1. μ—­ 이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬. 2. μ—­ 이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - * μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - * κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - * μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - * 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - * 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. + - κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From b22c5c484a100b6f4b1b302e027fabdb4f6b6e5b Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 04:41:28 +0900 Subject: [PATCH 017/101] docs: update README.md --- docs/README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/README.md b/docs/README.md index 485cafab4..7d5972fe9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,37 +26,37 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] '3. ꡬ간 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ꡬ간 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. - [x] '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ - - μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [ ] μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [ ] λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [ ] ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [ ] μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. ### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - - 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [ ] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - - 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - - μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - - μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - - μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - - μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. - - 확인 및 μ·¨μ†Œ λ²„νŠΌ + - [ ] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) + - [ ] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + - [ ] μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - [ ] 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - - μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - - μ˜ˆμ™Έ 처리 + - [ ] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + - [ ] μ˜ˆμ™Έ 처리 1. μ—­ 이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬. 2. μ—­ 이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - - μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - - κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - - μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - - 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - - 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [ ] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. + - [ ] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - [ ] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - [ ] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - [ ] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From c1741d0336f65ac9676782636525e41279dc429a Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 05:49:05 +0900 Subject: [PATCH 018/101] feat, refactor: use LocalStorage value to draw StationMangerView --- src/Menu/MenuView.js | 31 +++++++++++++++++++++++-------- src/index.js | 8 ++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 5d5c02bb0..86afe7fd8 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -12,20 +12,35 @@ export default class MenuView { static StationManagerView() { document.getElementById('sub-view-container').innerHTML = `

μ—­ 이름

+
+

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

+
+ `; + this.StationInputView(); + this.StationTableView(); + } + + static StationInputView() { + document.getElementById('station-input-view').innerHTML = ` -

πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

+ `; + } + + static StationTableView() { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('station-table-view').innerHTML = ` - - + + + ${stations.map((station) => ` - - - -
μ—­ 이름섀정역 이름섀정
hello
- `; + ${station} + + `).join('')} + `; } static LineManagerView() { diff --git a/src/index.js b/src/index.js index e69de29bb..e0a5b71a6 100644 --- a/src/index.js +++ b/src/index.js @@ -0,0 +1,8 @@ +import MenuView from './Menu/MenuView.js'; +import MenuController from './Menu/MenuController.js'; + +MenuView.MenuButtonListView(); +MenuController.ButtonEventController(); + +localStorage.setItem('Stations', ['인천', 'μ„œμšΈμ—­', '신도림', 'μ†Œμš”μ‚°']); +localStorage.setItem('Lines', ['1ν˜Έμ„ ', '2ν˜Έμ„ ', '3ν˜Έμ„ ']); From efb5656fdc0b03a542f6678604e7a31d913b8c0e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 05:55:41 +0900 Subject: [PATCH 019/101] fix: delete id in add button in LineMangerView --- src/Menu/MenuView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 86afe7fd8..cf6c4534a 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -61,7 +61,7 @@ export default class MenuView {

- +

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

From 8ca1238ff4fd1bfec6252419964d9405eda84df1 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 06:05:26 +0900 Subject: [PATCH 020/101] docs: update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 7d5972fe9..3b6005a66 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,7 +26,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] '3. ꡬ간 관리' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ꡬ간 관리 λ·°λ₯Ό μš”μ²­ν•œλ‹€. - [x] '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ - - [ ] μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [x] μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - [ ] λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - [ ] ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - [ ] μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. From 859c08ecad73e0b58f23623e1221a9e8ab859a0b Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 14:10:27 +0900 Subject: [PATCH 021/101] feat, refactor: use LocalStorage value to draw LineMangerView --- src/Menu/MenuView.js | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index cf6c4534a..d3ed14211 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -46,23 +46,34 @@ export default class MenuView { static LineManagerView() { document.getElementById('sub-view-container').innerHTML = `

λ…Έμ„  이름

- +

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

+
+
+
+ `; + this.LineInputView(); + this.LineTableView(); + } + + static LineInputView() { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('line-input').innerHTML = `

상행 쒅점

ν•˜ν–‰ 쒅점

- -

πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

+ `; + } + + static LineTableView() { + const lines = localStorage.getItem('Lines').split(','); + document.getElementById('line-table').innerHTML = `
@@ -70,14 +81,14 @@ export default class MenuView { + ${lines.map((line) => ` - + - -
λ…Έμ„  μ΄λ¦„ν•˜ν–‰ 쒅점역 μ„€μ •
1ν˜Έμ„ ${line} 인천 μ†Œμš”μ‚°
- `; + `).join('')} + `; } static SectionManagerView() { From 538e3d3d51156a9c46f25c84a22a6be8dbdfad99 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 14:25:22 +0900 Subject: [PATCH 022/101] feat, refactor: use LocalStorage value to draw SectionMangerView --- src/Menu/MenuView.js | 69 +++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index d3ed14211..f350f84df 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -93,37 +93,52 @@ export default class MenuView { static SectionManagerView() { document.getElementById('sub-view-container').innerHTML = ` -

ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

- - - - - `; + `; + } + + static SectionTableView() { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('section-table').innerHTML = ` + + + + + + ${stations.map((station) => ` + + + + + `).join('')} +
μˆœμ„œμ΄λ¦„μ„€μ •
${stations.indexOf(station)}${station}
`; } static MapPrintManagerView() { From 30feeba09b6ab5b414e3cb3e5d7ce9a8f735d79e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 14:30:56 +0900 Subject: [PATCH 023/101] feat, refactor: use LocalStorage value to draw MapPrintManagerView --- src/Menu/MenuView.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index f350f84df..70648ee64 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -142,17 +142,15 @@ export default class MenuView { } static MapPrintManagerView() { + const stations = localStorage.getItem('Stations').split(','); + const lines = localStorage.getItem('Lines').split(','); document.getElementById('sub-view-container').innerHTML = ` -

1ν˜Έμ„ 

-
    -
  • 인천
  • -
  • μ†Œμš”μ‚°
  • -
-

2ν˜Έμ„ 

+ ${lines.map((line) => ` +

${line}

    -
  • μ‹œμ²­
  • -
  • 신도림
  • -
+
  • ${stations[0]}
  • +
  • ${stations[stations.length - 1]}
  • + `).join('')} `; } } From ec4961e18050c6f4aed55c076c42f1bdcff511a8 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 14:31:52 +0900 Subject: [PATCH 024/101] docs: update README.md --- docs/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 3b6005a66..e51add3cb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -27,9 +27,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] '4. μ§€ν•˜μ²  노선도 좜λ ₯' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ - [x] μ—­ 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - [ ] λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - [ ] ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. - - [ ] μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [x] λ…Έμ„  관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [x] ꡬ간 관리 λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. + - [x] μ§€ν•˜μ²  노선도 좜λ ₯ λ·°λ₯Ό ν‘œμ‹œν•œλ‹€. ### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From 0d06efa5806aae3e968e33a3a8c1d89e98d2bf79 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 14:48:23 +0900 Subject: [PATCH 025/101] feat, refactor: create StationManagerView module --- src/Menu/MenuView.js | 34 ++------------------- src/StationManger/StationManagerView.js | 39 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 src/StationManger/StationManagerView.js diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 70648ee64..697774764 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -1,3 +1,5 @@ +import StationManagerView from '../StationManger/StationManagerView.js' + export default class MenuView { static MenuButtonListView() { document.getElementById('app').innerHTML += ` @@ -10,37 +12,7 @@ export default class MenuView { } static StationManagerView() { - document.getElementById('sub-view-container').innerHTML = ` -

    μ—­ 이름

    -
    -

    πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

    -
    - `; - this.StationInputView(); - this.StationTableView(); - } - - static StationInputView() { - document.getElementById('station-input-view').innerHTML = ` - - - `; - } - - static StationTableView() { - const stations = localStorage.getItem('Stations').split(','); - document.getElementById('station-table-view').innerHTML = ` - - - - - - ${stations.map((station) => ` - - - - `).join('')} -
    μ—­ 이름섀정
    ${station}
    `; + StationManagerView.View(); } static LineManagerView() { diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js new file mode 100644 index 000000000..b0b0c2608 --- /dev/null +++ b/src/StationManger/StationManagerView.js @@ -0,0 +1,39 @@ +export default class StationManagerView { + static View() { + this.StationInitView(); + this.StationInputView(); + this.StationTableView(); + } + + static StationInitView() { + document.getElementById('sub-view-container').innerHTML = ` +
    +
    + `; + } + + static StationInputView() { + document.getElementById('station-input-view').innerHTML = ` +

    μ—­ 이름

    + + + `; + } + + static StationTableView() { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('station-table-view').innerHTML = ` +

    πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

    + + + + + + ${stations.map((station) => ` + + + + `).join('')} +
    μ—­ 이름섀정
    ${station}
    `; + } +} \ No newline at end of file From bf7f042a7d6ce582171859b800e145008c2f703d Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Thu, 10 Dec 2020 15:01:07 +0900 Subject: [PATCH 026/101] feat: add EventListener to StationMangerController --- src/StationManger/StationManagerController.js | 22 +++++++++++++++++++ src/StationManger/StationManagerView.js | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/StationManger/StationManagerController.js diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js new file mode 100644 index 000000000..91a4a92a8 --- /dev/null +++ b/src/StationManger/StationManagerController.js @@ -0,0 +1,22 @@ +import StationManagerView from './StationManagerView.js'; + +export default class StationManagerController { + static ButtonEventController() { + document.addEventListener('click', (event) => { + const eventId = event.target.id; + if (eventId === 'add') { + this.addButtonClicked(); + } else if (eventId === 'delete') { + this.deleteButtonClicked(); + } + }); + } + + static addButtonClicked() { + alert('add'); + } + + static deleteButtonClicked() { + alert('delete'); + } +} \ No newline at end of file diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index b0b0c2608..f423682b3 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -16,7 +16,7 @@ export default class StationManagerView { document.getElementById('station-input-view').innerHTML = `

    μ—­ 이름

    - + `; } From c94229ca8d29941e8f23bc8d8dfa2e45785157a3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:36:14 +0900 Subject: [PATCH 027/101] feat: check Station Name --- src/StationManger/StationManagerModel.js | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/StationManger/StationManagerModel.js diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js new file mode 100644 index 000000000..4763ab5e4 --- /dev/null +++ b/src/StationManger/StationManagerModel.js @@ -0,0 +1,32 @@ +export default class StationManagerModel { + static isValidName(station) { + return (!this.isDuplicated(station) && !this.isSpace(station) && !this.isEnglish(station) + && !this.isSpecialChar(station) && !this.isValidLength(station) + && !this.isSingleKoreanAlphabet(station)); + } + + static isDuplicated(station) { + const stations = localStorage.getItem('Stations').split(','); + return stations.indexOf(station) > -1; + } + + static isSpace(station) { + return station.indexOf(' ') > -1; + } + + static isEnglish(station) { + return /[a-z]/.test(station); + } + + static isSpecialChar(station) { + return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(station); + } + + static isValidLength(station) { + return station.length < 2; + } + + static isSingleKoreanAlphabet(station) { + return /[^κ°€-힣]/.test(station); + } +} From 83586d6ce2f3f2f07e3d19454f5838f1223fe88c Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:37:20 +0900 Subject: [PATCH 028/101] feat: add id and class name to input and button --- src/StationManger/StationManagerView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index f423682b3..1f1167b44 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -15,8 +15,8 @@ export default class StationManagerView { static StationInputView() { document.getElementById('station-input-view').innerHTML = `

    μ—­ 이름

    - - + + `; } @@ -32,7 +32,7 @@ export default class StationManagerView { ${stations.map((station) => ` ${station} - + `).join('')} `; } From 0ef952ac1c4078a9ad00a565b895b10116134f1f Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:37:34 +0900 Subject: [PATCH 029/101] docs: update README.md --- docs/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index e51add3cb..1f7779845 100644 --- a/docs/README.md +++ b/docs/README.md @@ -38,15 +38,15 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - - [ ] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - - [ ] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - - [ ] μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) + - [x] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + - [x] μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. - [ ] 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - - [ ] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - - [ ] μ˜ˆμ™Έ 처리 + - [x] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + - [x] μ˜ˆμ™Έ 처리 1. μ—­ 이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬. 2. μ—­ 이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. From 28f4e2f78bb305308098b45e73878422c79d397d Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:43:59 +0900 Subject: [PATCH 030/101] feat: request Alert and Update Input View if Invalid Name --- src/StationManger/StationManagerController.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 91a4a92a8..d8b2b145b 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -1,19 +1,25 @@ import StationManagerView from './StationManagerView.js'; +import StationManagerModel from './StationManagerModel.js'; export default class StationManagerController { static ButtonEventController() { document.addEventListener('click', (event) => { const eventId = event.target.id; - if (eventId === 'add') { + if (eventId === 'station-add-button') { this.addButtonClicked(); - } else if (eventId === 'delete') { + } else if (eventId === 'station-delete-button') { this.deleteButtonClicked(); } }); } static addButtonClicked() { - alert('add'); + const station = document.getElementById('station-name-input').value; + if (!StationManagerModel.isValidName(station)) { + alert('input error'); + StationManagerView.StationInputView(); + return; + }; } static deleteButtonClicked() { From 153c8789002a567bb1ad43da2a882527f9082c46 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:44:16 +0900 Subject: [PATCH 031/101] docs: update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 1f7779845..73cd6c7f2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,6 +34,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - [ ] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우, μ—λŸ¬λ©”μ„Έμ§€ 좜λ ₯ 및 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. @@ -52,7 +53,6 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - - [ ] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - [ ] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [ ] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [ ] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. From 2c8064b611ce0b912671347ee8dc8c697177987d Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:47:04 +0900 Subject: [PATCH 032/101] feat: alert Invalid Station Name --- src/StationManger/StationManagerController.js | 2 +- src/StationManger/StationManagerView.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index d8b2b145b..c895222fe 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -16,7 +16,7 @@ export default class StationManagerController { static addButtonClicked() { const station = document.getElementById('station-name-input').value; if (!StationManagerModel.isValidName(station)) { - alert('input error'); + StationManagerView.alertNameError(); StationManagerView.StationInputView(); return; }; diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index 1f1167b44..de4640641 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -36,4 +36,8 @@ export default class StationManagerView { `).join('')} `; } + + static alertNameError() { + alert('invalid Error'); + } } \ No newline at end of file From 6c990bb77db86f8a4fe545002f855f5b7c1a6b37 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:54:46 +0900 Subject: [PATCH 033/101] feat: add Station to Station List --- src/StationManger/StationManagerController.js | 5 ++++- src/StationManger/StationManagerModel.js | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index c895222fe..bb140c501 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -19,7 +19,10 @@ export default class StationManagerController { StationManagerView.alertNameError(); StationManagerView.StationInputView(); return; - }; + } + StationManagerModel.add(station); + StationManagerView.StationInputView(); + StationManagerView.StationTableView(); } static deleteButtonClicked() { diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 4763ab5e4..082e1f4c5 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -1,4 +1,10 @@ export default class StationManagerModel { + static add(station) { + const stations = localStorage.getItem('Stations').split(','); + stations.push(station); + localStorage.setItem('Stations', stations); + } + static isValidName(station) { return (!this.isDuplicated(station) && !this.isSpace(station) && !this.isEnglish(station) && !this.isSpecialChar(station) && !this.isValidLength(station) From 4c51e689eb961cb14926a4275232130d700b7ca5 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 16:55:09 +0900 Subject: [PATCH 034/101] docs: update README.md --- docs/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 73cd6c7f2..065ed577d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -33,7 +33,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### μ§€ν•˜μ²  μ—­ 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - - [ ] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - [x] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우, μ—λŸ¬λ©”μ„Έμ§€ 좜λ ₯ 및 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. @@ -42,7 +42,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - [x] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - [x] μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. - [ ] 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) @@ -53,9 +53,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd 3. μ—­ 이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬. 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - - [ ] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - [x] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [ ] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - - [ ] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - [x] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - [ ] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ From 4060eeada4e2c43541464b9b2571a5dd5732abc3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 23:05:11 +0900 Subject: [PATCH 035/101] feat: check station in Stations for delete --- src/StationManger/StationManagerController.js | 2 +- src/StationManger/StationManagerModel.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index bb140c501..e2d35e085 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -28,4 +28,4 @@ export default class StationManagerController { static deleteButtonClicked() { alert('delete'); } -} \ No newline at end of file +} diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 082e1f4c5..549894e40 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -35,4 +35,12 @@ export default class StationManagerModel { static isSingleKoreanAlphabet(station) { return /[^κ°€-힣]/.test(station); } + + static delete() { + + } + + static IsInStations(station) { + return localStorage.getItem('Stations').join(',').indexOf(station) > -1; + } } From 6cfd37f8452efb94fee3d10a435f233389dbdb07 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 23:46:58 +0900 Subject: [PATCH 036/101] feat: delete Station from Stations --- src/StationManger/StationManagerController.js | 16 ++++++++++++---- src/StationManger/StationManagerModel.js | 12 ++++++++---- src/StationManger/StationManagerView.js | 4 ++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index e2d35e085..7866fc6d1 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -5,10 +5,12 @@ export default class StationManagerController { static ButtonEventController() { document.addEventListener('click', (event) => { const eventId = event.target.id; + const eventClassName = event.target.className; if (eventId === 'station-add-button') { this.addButtonClicked(); - } else if (eventId === 'station-delete-button') { - this.deleteButtonClicked(); + } else if (eventClassName === 'station-delete-button') { + const button = event.path[0]; + this.deleteButtonClicked(button); } }); } @@ -25,7 +27,13 @@ export default class StationManagerController { StationManagerView.StationTableView(); } - static deleteButtonClicked() { - alert('delete'); + static deleteButtonClicked(button) { + const buttons = document.getElementsByClassName('station-delete-button'); + const buttonsArray = Array.from(buttons); + const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; + console.log(station); + // alert('delete'); + StationManagerModel.delete(station); + StationManagerView.StationTableView(); } } diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 549894e40..73ff35960 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -36,11 +36,15 @@ export default class StationManagerModel { return /[^κ°€-힣]/.test(station); } - static delete() { - + static delete(station) { + if (this.isInStations(station)) { + const stations = localStorage.getItem('Stations').split(','); + stations.splice(stations.indexOf(station), 1); + localStorage.setItem('Stations', stations); + } } - static IsInStations(station) { - return localStorage.getItem('Stations').join(',').indexOf(station) > -1; + static isInStations(station) { + return localStorage.getItem('Stations').split(',').indexOf(station) > -1; } } diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index de4640641..dd682c130 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -31,8 +31,8 @@ export default class StationManagerView { ${stations.map((station) => ` - ${station} - + ${station} + `).join('')} `; } From cf677e910e72618e15d59521f113bc9637f6d0a6 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Fri, 11 Dec 2020 23:49:06 +0900 Subject: [PATCH 037/101] docs: update README.md --- docs/README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 065ed577d..deb8f239c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -54,9 +54,14 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd 4. μ—­ 이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬(ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. μ—­ 이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - [x] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - - [ ] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - [x] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - - [ ] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [x] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [ ] κ³ λ €ν•΄μ•Ό ν•  사항 + - λ§Œμ•½, 역이 ν•˜λ‚˜λ„ μ—†λ‹€λ©΄ μ–΄λ–»κ²Œ ν•  것인지? + - μ΅œμ†Œ μ—­μ˜ 개수λ₯Ό μ§€μ •ν•  것인지 + - μ‚­μ œν–ˆμ„ λ•Œ 각 노선에 2개 μ΄ν•˜κ°€ λ˜λŠ” 곳이 있으면 μ‚­μ œλ₯Ό ν•˜μ§€ μ•Šμ„ 것인지. + - μ‚­μ œκ°€ λ˜μ§€ μ•ŠλŠ” 경우 κ²½κ³  창을 λ„μšΈ 것인지? ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From 121041f42fc9e832f5280bc6a952077e03a32259 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 00:04:54 +0900 Subject: [PATCH 038/101] feat: confirm delete action --- src/StationManger/StationManagerView.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index dd682c130..f42cd92a2 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -37,7 +37,11 @@ export default class StationManagerView { `; } - static alertNameError() { + static AlertNameError() { alert('invalid Error'); } + + static AlertDelete() { + return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); + } } \ No newline at end of file From d1ad95c5cb416d2d4d2fa8ab86bb0de936577f74 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 00:05:55 +0900 Subject: [PATCH 039/101] feat: delete or not by User's Choice --- src/StationManger/StationManagerController.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 7866fc6d1..19f2a21c3 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -31,9 +31,11 @@ export default class StationManagerController { const buttons = document.getElementsByClassName('station-delete-button'); const buttonsArray = Array.from(buttons); const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - console.log(station); - // alert('delete'); - StationManagerModel.delete(station); - StationManagerView.StationTableView(); + if (StationManagerView.AlertDelete()) { + StationManagerModel.delete(station); + StationManagerView.StationTableView(); + } else { + StationManagerView.StationInputView(); + } } } From ea1b80db38de8791d68bf41b4d0fd5419c0ab1fc Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 00:06:14 +0900 Subject: [PATCH 040/101] docs: update README.md --- docs/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index deb8f239c..673715371 100644 --- a/docs/README.md +++ b/docs/README.md @@ -35,16 +35,16 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd 1. 이벀트 관리 (Controller) - [x] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - [x] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우, μ—λŸ¬λ©”μ„Έμ§€ 좜λ ₯ 및 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - [s] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [s] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - [x] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - [x] μ—­ λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - [x] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. - - [ ] 확인 및 μ·¨μ†Œ λ²„νŠΌ + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - [x] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ—­ 이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - [x] μ˜ˆμ™Έ 처리 From f282608f9754d1cb18ca9c7193966f73949debd2 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 00:30:41 +0900 Subject: [PATCH 041/101] style: change method name initial from upper-case to lower-case --- src/Menu/MenuController.js | 10 +++--- src/Menu/MenuView.js | 32 +++++++++---------- src/StationManger/StationManagerController.js | 12 +++---- src/StationManger/StationManagerView.js | 18 +++++------ src/index.js | 9 ++++-- 5 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/Menu/MenuController.js b/src/Menu/MenuController.js index 316180aea..8252cb6b6 100644 --- a/src/Menu/MenuController.js +++ b/src/Menu/MenuController.js @@ -1,20 +1,20 @@ import MenuView from './MenuView.js'; export default class MenuController { - static ButtonEventController() { + static buttonEventController() { document.addEventListener('click', (event) => { const eventId = event.target.id; if (eventId === 'station-manager-button') { - MenuView.StationManagerView(); + MenuView.stationManagerView(); } if (eventId === 'line-manager-button') { - MenuView.LineManagerView(); + MenuView.lineManagerView(); } if (eventId === 'section-manager-button') { - MenuView.SectionManagerView(); + MenuView.sectionManagerView(); } if (eventId === 'map-print-manager-button') { - MenuView.MapPrintManagerView(); + MenuView.mapPrintManagerView(); } }); } diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 697774764..0faaad343 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -1,7 +1,7 @@ import StationManagerView from '../StationManger/StationManagerView.js' export default class MenuView { - static MenuButtonListView() { + static menuButtonListView() { document.getElementById('app').innerHTML += ` @@ -11,11 +11,11 @@ export default class MenuView { `; } - static StationManagerView() { - StationManagerView.View(); + static stationManagerView() { + StationManagerView.view(); } - static LineManagerView() { + static lineManagerView() { document.getElementById('sub-view-container').innerHTML = `

    λ…Έμ„  이름

    πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

    @@ -23,11 +23,11 @@ export default class MenuView {
    `; - this.LineInputView(); - this.LineTableView(); + this.lineInputView(); + this.lineTableView(); } - static LineInputView() { + static lineInputView() { const stations = localStorage.getItem('Stations').split(','); document.getElementById('line-input').innerHTML = `

    상행 쒅점 @@ -43,7 +43,7 @@ export default class MenuView { `; } - static LineTableView() { + static lineTableView() { const lines = localStorage.getItem('Lines').split(','); document.getElementById('line-table').innerHTML = ` @@ -63,19 +63,19 @@ export default class MenuView {
    `; } - static SectionManagerView() { + static lectionManagerView() { document.getElementById('sub-view-container').innerHTML = `


    `; - this.SectionSelectView(); - this.SectionInputView(0); - this.SectionTableView(); + this.sectionSelectView(); + this.sectionInputView(0); + this.sectionTableView(); } - static SectionSelectView() { + static sectionSelectView() { const lines = localStorage.getItem('Lines').split(','); document.getElementById('section-select').innerHTML = `

    ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

    @@ -83,7 +83,7 @@ export default class MenuView { `; } - static SectionInputView(index) { + static sectionInputView(index) { const lines = localStorage.getItem('Lines').split(','); const stations = localStorage.getItem('Stations').split(','); document.getElementById('section-input').innerHTML = ` @@ -96,7 +96,7 @@ export default class MenuView { `; } - static SectionTableView() { + static sectionTableView() { const stations = localStorage.getItem('Stations').split(','); document.getElementById('section-table').innerHTML = ` @@ -113,7 +113,7 @@ export default class MenuView {
    `; } - static MapPrintManagerView() { + static mapPrintManagerView() { const stations = localStorage.getItem('Stations').split(','); const lines = localStorage.getItem('Lines').split(','); document.getElementById('sub-view-container').innerHTML = ` diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 19f2a21c3..6a4cf8f9f 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -19,23 +19,23 @@ export default class StationManagerController { const station = document.getElementById('station-name-input').value; if (!StationManagerModel.isValidName(station)) { StationManagerView.alertNameError(); - StationManagerView.StationInputView(); + StationManagerView.stationInputView(); return; } StationManagerModel.add(station); - StationManagerView.StationInputView(); - StationManagerView.StationTableView(); + StationManagerView.stationInputView(); + StationManagerView.stationTableView(); } static deleteButtonClicked(button) { const buttons = document.getElementsByClassName('station-delete-button'); const buttonsArray = Array.from(buttons); const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - if (StationManagerView.AlertDelete()) { + if (StationManagerView.confirmDelete()) { StationManagerModel.delete(station); - StationManagerView.StationTableView(); + StationManagerView.stationTableView(); } else { - StationManagerView.StationInputView(); + StationManagerView.stationInputView(); } } } diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index f42cd92a2..d7dab5daa 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -1,18 +1,18 @@ export default class StationManagerView { - static View() { - this.StationInitView(); - this.StationInputView(); - this.StationTableView(); + static view() { + this.stationInitView(); + this.stationInputView(); + this.stationTableView(); } - static StationInitView() { + static stationInitView() { document.getElementById('sub-view-container').innerHTML = `
    `; } - static StationInputView() { + static stationInputView() { document.getElementById('station-input-view').innerHTML = `

    μ—­ 이름

    @@ -20,7 +20,7 @@ export default class StationManagerView { `; } - static StationTableView() { + static stationTableView() { const stations = localStorage.getItem('Stations').split(','); document.getElementById('station-table-view').innerHTML = `

    πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

    @@ -37,11 +37,11 @@ export default class StationManagerView { `; } - static AlertNameError() { + static alertNameError() { alert('invalid Error'); } - static AlertDelete() { + static confirmDelete() { return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); } } \ No newline at end of file diff --git a/src/index.js b/src/index.js index e0a5b71a6..2fd340c35 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,13 @@ import MenuView from './Menu/MenuView.js'; import MenuController from './Menu/MenuController.js'; -MenuView.MenuButtonListView(); -MenuController.ButtonEventController(); +import StationMangerController from './StationManger/StationManagerController.js'; + +MenuView.menuButtonListView(); +MenuController.buttonEventController(); +StationMangerController.buttonEventController(); localStorage.setItem('Stations', ['인천', 'μ„œμšΈμ—­', '신도림', 'μ†Œμš”μ‚°']); localStorage.setItem('Lines', ['1ν˜Έμ„ ', '2ν˜Έμ„ ', '3ν˜Έμ„ ']); + +console.log(localStorage.getItem('Lines')); From 55b6354c5d7b759f37d83c1505813c8159125a5e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 00:39:48 +0900 Subject: [PATCH 042/101] feat: delete Action when Delete Canceled --- src/StationManger/StationManagerController.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 6a4cf8f9f..29ac526e4 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -34,8 +34,6 @@ export default class StationManagerController { if (StationManagerView.confirmDelete()) { StationManagerModel.delete(station); StationManagerView.stationTableView(); - } else { - StationManagerView.stationInputView(); } } } From d4f14cac406f8f15c23dd7afd3b3764f9a344ea3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:24:15 +0900 Subject: [PATCH 043/101] fix: correct Name Error --- src/Menu/MenuView.js | 49 ++----------------- src/StationManger/StationManagerController.js | 2 +- 2 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 0faaad343..49a60a438 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -1,4 +1,5 @@ import StationManagerView from '../StationManger/StationManagerView.js' +import LineManagerView from '../LineManger/LineManagerView.js'; export default class MenuView { static menuButtonListView() { @@ -16,54 +17,10 @@ export default class MenuView { } static lineManagerView() { - document.getElementById('sub-view-container').innerHTML = ` -

    λ…Έμ„  이름

    -

    πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

    -
    -
    -
    - `; - this.lineInputView(); - this.lineTableView(); - } - - static lineInputView() { - const stations = localStorage.getItem('Stations').split(','); - document.getElementById('line-input').innerHTML = ` -

    상행 쒅점 - -

    -

    ν•˜ν–‰ 쒅점 - -

    - `; - } - - static lineTableView() { - const lines = localStorage.getItem('Lines').split(','); - document.getElementById('line-table').innerHTML = ` - - - - - - - - ${lines.map((line) => ` - - - - - - `).join('')} -
    λ…Έμ„  이름상행 μ’…μ μ—­ν•˜ν–‰ 쒅점역섀정
    ${line}μΈμ²œμ†Œμš”μ‚°
    `; + LineManagerView.view(); } - static lectionManagerView() { + static sectionManagerView() { document.getElementById('sub-view-container').innerHTML = `
    diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 29ac526e4..368945e56 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -2,7 +2,7 @@ import StationManagerView from './StationManagerView.js'; import StationManagerModel from './StationManagerModel.js'; export default class StationManagerController { - static ButtonEventController() { + static buttonEventController() { document.addEventListener('click', (event) => { const eventId = event.target.id; const eventClassName = event.target.className; From 43764c32adc1fec9290e0594951e1b657ba27045 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:24:49 +0900 Subject: [PATCH 044/101] fix: create LineManagerView --- src/LineManger/LineManagerController.js | 3 ++ src/LineManger/LineManagerModel.js | 3 ++ src/LineManger/LineManagerView.js | 50 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/LineManger/LineManagerController.js create mode 100644 src/LineManger/LineManagerModel.js create mode 100644 src/LineManger/LineManagerView.js diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js new file mode 100644 index 000000000..95c3cb2dd --- /dev/null +++ b/src/LineManger/LineManagerController.js @@ -0,0 +1,3 @@ +export default LineManagerController { + +} \ No newline at end of file diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js new file mode 100644 index 000000000..17f854643 --- /dev/null +++ b/src/LineManger/LineManagerModel.js @@ -0,0 +1,3 @@ +export default class LineManagerModel { + +} \ No newline at end of file diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js new file mode 100644 index 000000000..552145a5c --- /dev/null +++ b/src/LineManger/LineManagerView.js @@ -0,0 +1,50 @@ +export default class LineManagerView { + static view() { + document.getElementById('sub-view-container').innerHTML = ` +

    λ…Έμ„  이름

    +

    πŸš‰ μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘

    +
    +
    +
    + `; + this.lineInputView(); + this.lineTableView(); + } + + static lineInputView() { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('line-input').innerHTML = ` + +

    상행 쒅점 + +

    +

    ν•˜ν–‰ 쒅점 + +

    + `; + } + + static lineTableView() { + const lines = JSON.parse(localStorage.getItem('Lines')); + document.getElementById('line-table').innerHTML = ` + + + + + + + + ${Object.keys(lines).map((line) => ` + + + + + + `).join('')} +
    λ…Έμ„  이름상행 μ’…μ μ—­ν•˜ν–‰ 쒅점역섀정
    ${line}${lines[line][0]}${lines[line][(lines[line].length - 1)]}
    `; + } +} \ No newline at end of file From 5cdd2fb3b455f3ff66bdb577f91fced7b8f31d25 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:32:11 +0900 Subject: [PATCH 045/101] feat: add dataset to line-delete-button --- src/LineManger/LineManagerView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index 552145a5c..f3e806bda 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -43,7 +43,7 @@ export default class LineManagerView { ${line} ${lines[line][0]} ${lines[line][(lines[line].length - 1)]} - + `).join('')} `; } From 80276151f63253b4b77f1989ffe136367351c462 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:32:27 +0900 Subject: [PATCH 046/101] feat: add Event Handler --- src/LineManger/LineManagerController.js | 26 +++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 95c3cb2dd..1cca9d18c 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -1,3 +1,25 @@ -export default LineManagerController { - +import LineManagerView from './LineManagerView.js'; +import LineManagerModel from './LineManagerModel.js'; + +export default class LineManagerController { + static buttonEventController() { + document.addEventListener('click', (event) => { + const eventId = event.target.id; + const eventClassName = event.target.className; + if (eventId === 'line-add-button') { + this.addButtonClicked(); + } else if (eventClassName === 'line-delete-button') { + const button = event.path[0]; + this.deleteButtonClicked(button); + } + }); + } + + static addButtonClicked() { + + } + + static deleteButtonClicked() { + + } } \ No newline at end of file From 0c93f1d0e9e50f72224c065d01de0019783f85aa Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:43:24 +0900 Subject: [PATCH 047/101] feat: check Line Name is Valid --- src/LineManger/LineManagerModel.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 17f854643..d64a8bf36 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -1,3 +1,32 @@ export default class LineManagerModel { + static isValidName(line) { + return (!this.isDuplicated(line) && !this.isSpace(line) && !this.isEnglish(line) + && !this.isSpecialChar(line) && !this.isValidLength(line) + && !this.isSingleKoreanAlphabet(line)); + } + static isDuplicated(line) { + const lines = Object.keys(JSON.parse(localStorage.getItem('Lines'))); + return lines.indexOf(line) > -1; + } + + static isSpace(line) { + return line.indexOf(' ') > -1; + } + + static isEnglish(line) { + return /[a-z]/.test(line); + } + + static isSpecialChar(line) { + return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(line); + } + + static isValidLength(line) { + return line.length < 2; + } + + static isSingleKoreanAlphabet(line) { + return /[^κ°€-힣]/.test(line); + } } \ No newline at end of file From 4d30ac8db1eb53934ef375240da8aef714c4f726 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:51:30 +0900 Subject: [PATCH 048/101] feat: alert and reload input view if input error --- src/LineManger/LineManagerController.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 1cca9d18c..30c6b143c 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -16,10 +16,14 @@ export default class LineManagerController { } static addButtonClicked() { - + const line = document.getElementById('line-name-input').value; + if (!LineManagerModel.isValidName(line)) { + alert('error'); + LineManagerView.lineInputView(); + }; } static deleteButtonClicked() { - + } } \ No newline at end of file From a70cef120d1f44e9bced2c3cc39f4d46d91b50a2 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 01:54:14 +0900 Subject: [PATCH 049/101] fix: edit RegExp of is SingleKoreanAlpabet as number included string invalid before --- src/LineManger/LineManagerModel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index d64a8bf36..14b2dd068 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -27,6 +27,6 @@ export default class LineManagerModel { } static isSingleKoreanAlphabet(line) { - return /[^κ°€-힣]/.test(line); + return /[^κ°€-힣a-z0-9]/.test(line); } } \ No newline at end of file From ff0294f8064963b045ddf20c5e0d1e1801877cc5 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:00:02 +0900 Subject: [PATCH 050/101] feat: check input-line-start is same with input-line-end --- src/LineManger/LineManagerModel.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 14b2dd068..ca81aae20 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -29,4 +29,8 @@ export default class LineManagerModel { static isSingleKoreanAlphabet(line) { return /[^κ°€-힣a-z0-9]/.test(line); } + + static isSame(lineStart, lineEnd) { + return lineStart === lineEnd; + } } \ No newline at end of file From 0a81f85504f4683f59d8e195e031ed7e86bf50e6 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:10:19 +0900 Subject: [PATCH 051/101] feat: add new Line to Lines --- src/LineManger/LineManagerModel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index ca81aae20..424876d68 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -33,4 +33,9 @@ export default class LineManagerModel { static isSame(lineStart, lineEnd) { return lineStart === lineEnd; } + + static add(line, lineStart, lineEnd) { + const lines = JSON.parse(localStorage.getItem('Lines')); + lines[line] = [lineStart, lineEnd]; + } } \ No newline at end of file From dbe26054c302de6c4398effcb149745dafaf4ef0 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:13:26 +0900 Subject: [PATCH 052/101] feat: set localStorage 'Lines' by new Json --- src/LineManger/LineManagerModel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 424876d68..46a281863 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -37,5 +37,6 @@ export default class LineManagerModel { static add(line, lineStart, lineEnd) { const lines = JSON.parse(localStorage.getItem('Lines')); lines[line] = [lineStart, lineEnd]; + localStorage.setItem('Lines', JSON.stringify(lines)); } } \ No newline at end of file From e271efa22a4c11aaddab01addb37de0abc55dee3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:14:17 +0900 Subject: [PATCH 053/101] feat: alert error and if not call add, reload function --- src/LineManger/LineManagerController.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 30c6b143c..fd921c5d4 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -17,10 +17,16 @@ export default class LineManagerController { static addButtonClicked() { const line = document.getElementById('line-name-input').value; - if (!LineManagerModel.isValidName(line)) { + const lineStart = document.getElementById('line-start-station-selector').value; + const lineEnd = document.getElementById('line-end-station-selector').value; + if (!LineManagerModel.isValidName(line) || LineManagerModel.isSame(lineStart, lineEnd)) { alert('error'); LineManagerView.lineInputView(); - }; + return; + } + LineManagerModel.add(line, lineStart, lineEnd); + LineManagerView.lineInputView(); + LineManagerView.lineTableView(); } static deleteButtonClicked() { From 004507ca4e4b90687de9e379e67adaac1b25afed Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:15:40 +0900 Subject: [PATCH 054/101] docs: update README.md --- docs/README.md | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/README.md b/docs/README.md index 673715371..37b4f6352 100644 --- a/docs/README.md +++ b/docs/README.md @@ -36,8 +36,8 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 'μ—­ μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ—­ λͺ©λ‘ 좔가와, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - [x] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우, μ—λŸ¬λ©”μ„Έμ§€ 좜λ ₯ 및 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - [x] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - - [s] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - [s] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ μ—­ λͺ©λ‘μ—μ„œ ν•΄λ‹Ή μ—­ μ‚­μ œμ™€, μ—­ λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ 아무것도 ν•˜μ§€μ•ŠλŠ”λ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€ (μ—­ μž…λ ₯ 및 μ—­ λͺ©λ‘) - [x] μ—­ μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. @@ -65,31 +65,30 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - * 'λ…Έμ„  μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  λͺ©λ‘ 좔가와, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή λ…Έμ„  μ‚­μ œμ™€, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] 'λ…Έμ„  μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  λͺ©λ‘ 좔가와, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή λ…Έμ„  μ‚­μ œμ™€, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - * 전체 화면을 ν‘œμ‹œν•œλ‹€. (λ…Έμ„  μž…λ ₯ 및 λ…Έμ„  λͺ©λ‘) - * λ…Έμ„  μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - * λ…Έμ„  λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€. (λ…Έμ„  μž…λ ₯ 및 λ…Έμ„  λͺ©λ‘) + - [x] λ…Έμ„  μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. + - [x] λ…Έμ„  λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. + - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. * 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ λ…Έμ„  이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - * μ˜ˆμ™Έ 처리 + - [x] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ λ…Έμ„  이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + - [x] μ˜ˆμ™Έ 처리 1. λ…Έμ„  이름이 2자 미만인 경우 μ˜ˆμ™Έμ²˜λ¦¬ 2. λ…Έμ„  이름에 곡백이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ 3. λ…Έμ„  이름에 λͺ¨μŒμ΄λ‚˜ 자음만으둜 이루어져 μžˆλŠ” 뢀뢄이 μžˆμ„ 경우 μ˜ˆμ™Έμ²˜λ¦¬ 4. λ…Έμ„  이름에 영문이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ (ν•œκ΅­ μ§€ν•˜μ² λ‘œ 가정함) 5. λ…Έμ„  이름에 특수 λ¬Έμžκ°€ μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ - 6. λ…Έμ„  이름이 'μ„ '으둜 λλ‚˜μ§€ μ•ŠλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ (λ…Έμ„  μž„μ„ ν‘œμ‹œν•˜κΈ° μœ„ν•¨) - * μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. - * κΈ°μ‘΄ λ…Έμ„  λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - * 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) - * 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - * 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [x] μ˜ˆμ™Έ 사항에 ν•΄λ‹Ήν•˜λŠ” 경우 μ—­ μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•˜κ³ , μΆ”κ°€ 및 λͺ©λ‘ 갱신은 ν•˜μ§€ μ•ŠλŠ”λ‹€. + - [x] κΈ°μ‘΄ λ…Έμ„  λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. + - [x] 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) + - [x] 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - [ ] 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From 110178f83a27d551046531e26c776cf1251b005e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:28:57 +0900 Subject: [PATCH 055/101] feat: delete line from lines when button clicked --- src/LineManger/LineManagerController.js | 10 ++++++++-- src/LineManger/LineManagerModel.js | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index fd921c5d4..b2718b804 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -29,7 +29,13 @@ export default class LineManagerController { LineManagerView.lineTableView(); } - static deleteButtonClicked() { - + static deleteButtonClicked(button) { + const buttons = document.getElementsByClassName('line-delete-button'); + const buttonsArray = Array.from(buttons); + const line = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; + if (LineManagerModel.isInLines(line)) { + LineManagerModel.delete(line); + LineManagerView.lineTableView(); + } } } \ No newline at end of file diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 46a281863..010cc2470 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -39,4 +39,15 @@ export default class LineManagerModel { lines[line] = [lineStart, lineEnd]; localStorage.setItem('Lines', JSON.stringify(lines)); } + + static isInLines(line) { + const lines = Object.keys(JSON.parse(localStorage.getItem('Lines'))); + return lines.indexOf(line) > -1; + } + + static delete(line) { + const lines = JSON.parse(localStorage.getItem('Lines')); + delete lines[line]; + localStorage.setItem('Lines', JSON.stringify(lines)); + } } \ No newline at end of file From ef32cc082bcd0a9f2a911d84ef412afab0c00b3e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:31:53 +0900 Subject: [PATCH 056/101] feat: add Confirm delete message --- src/LineManger/LineManagerController.js | 3 ++- src/LineManger/LineManagerView.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index b2718b804..03346b74d 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -1,5 +1,6 @@ import LineManagerView from './LineManagerView.js'; import LineManagerModel from './LineManagerModel.js'; +import StationManagerView from '../StationManger/StationManagerView.js'; export default class LineManagerController { static buttonEventController() { @@ -33,7 +34,7 @@ export default class LineManagerController { const buttons = document.getElementsByClassName('line-delete-button'); const buttonsArray = Array.from(buttons); const line = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - if (LineManagerModel.isInLines(line)) { + if (LineManagerModel.isInLines(line) && StationManagerView.confirmDelete()) { LineManagerModel.delete(line); LineManagerView.lineTableView(); } diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index f3e806bda..646323b08 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -47,4 +47,8 @@ export default class LineManagerView { `).join('')} `; } + + static confirmDelete() { + return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); + } } \ No newline at end of file From 88497988c23ecfcc30d04b15084909114c971866 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:33:46 +0900 Subject: [PATCH 057/101] feat: add Alert message for name input error --- src/LineManger/LineManagerController.js | 2 +- src/LineManger/LineManagerView.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 03346b74d..4a215c50f 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -21,7 +21,7 @@ export default class LineManagerController { const lineStart = document.getElementById('line-start-station-selector').value; const lineEnd = document.getElementById('line-end-station-selector').value; if (!LineManagerModel.isValidName(line) || LineManagerModel.isSame(lineStart, lineEnd)) { - alert('error'); + LineManagerView.alertNameError(); LineManagerView.lineInputView(); return; } diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index 646323b08..9e096c67f 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -48,6 +48,10 @@ export default class LineManagerView { `; } + static alertNameError() { + alert('invalid Error'); + } + static confirmDelete() { return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); } From 65824cb4838f88052dd339e72e8fd976d4efa23b Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:34:04 +0900 Subject: [PATCH 058/101] docs: update README.md --- docs/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index 37b4f6352..0d1022083 100644 --- a/docs/README.md +++ b/docs/README.md @@ -66,15 +66,15 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - [x] 'λ…Έμ„  μΆ”κ°€' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λ…Έμ„  λͺ©λ‘ 좔가와, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - [ ] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή λ…Έμ„  μ‚­μ œμ™€, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] 'μ‚­μ œ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή λ…Έμ„  μ‚­μ œμ™€, λ…Έμ„  λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ 아무것도 ν•˜μ§€ μ•ŠλŠ”λ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€. (λ…Έμ„  μž…λ ₯ 및 λ…Έμ„  λͺ©λ‘) - [x] λ…Έμ„  μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - [x] λ…Έμ„  λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - - [ ] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. * 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) - [x] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ λ…Έμ„  이름이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. @@ -88,7 +88,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] κΈ°μ‘΄ λ…Έμ„  λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) - [x] 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - - [ ] 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [x] 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) From 3301029a401dc29ab22c3a1cb423f264974f92b7 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:48:03 +0900 Subject: [PATCH 059/101] feat: create SectionMangerView and import to MenuView --- src/Menu/MenuView.js | 49 +----------------------- src/SectionManager/SectionManagerView.js | 49 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 47 deletions(-) create mode 100644 src/SectionManager/SectionManagerView.js diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 49a60a438..7b34a080b 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -1,5 +1,6 @@ import StationManagerView from '../StationManger/StationManagerView.js' import LineManagerView from '../LineManger/LineManagerView.js'; +import SectionManagerView from '../SectionManager/SectionManagerView.js'; export default class MenuView { static menuButtonListView() { @@ -21,53 +22,7 @@ export default class MenuView { } static sectionManagerView() { - document.getElementById('sub-view-container').innerHTML = ` -
    -
    -
    -
    - `; - this.sectionSelectView(); - this.sectionInputView(0); - this.sectionTableView(); - } - - static sectionSelectView() { - const lines = localStorage.getItem('Lines').split(','); - document.getElementById('section-select').innerHTML = ` -

    ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

    - ${lines.map((line) => ` `).join('')} - `; - } - - static sectionInputView(index) { - const lines = localStorage.getItem('Lines').split(','); - const stations = localStorage.getItem('Stations').split(','); - document.getElementById('section-input').innerHTML = ` -

    ${lines[index]} 관리

    -

    ꡬ간 등둝

    - - - `; - } - - static sectionTableView() { - const stations = localStorage.getItem('Stations').split(','); - document.getElementById('section-table').innerHTML = ` - - - - - - ${stations.map((station) => ` - - - - - `).join('')} -
    μˆœμ„œμ΄λ¦„μ„€μ •
    ${stations.indexOf(station)}${station}
    `; + SectionManagerView.view(); } static mapPrintManagerView() { diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js new file mode 100644 index 000000000..08dc9c321 --- /dev/null +++ b/src/SectionManager/SectionManagerView.js @@ -0,0 +1,49 @@ +export default class SectionManagerView { + static view() { + document.getElementById('sub-view-container').innerHTML = ` +
    +
    +
    +
    + `; + this.sectionSelectView(); + } + + static sectionSelectView() { + const lines = JSON.parse(localStorage.getItem('Lines')); + document.getElementById('section-select').innerHTML = ` +

    ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

    + ${Object.keys(lines).map((line) => ` `).join('')} + `; + } + + static sectionInputView(line) { + const stations = localStorage.getItem('Stations').split(','); + document.getElementById('section-input').innerHTML = ` +

    ${line} 관리

    +

    ꡬ간 등둝

    + + + `; + } + + static sectionTableView(line) { + const lines = JSON.parse(localStorage.getItem('Lines')); + const stations = lines[line]; + document.getElementById('section-table').innerHTML = ` + + + + + + ${stations.map((station) => ` + + + + + `).join('')} +
    μˆœμ„œμ΄λ¦„μ„€μ •
    ${stations.indexOf(station)}${station}
    `; + } +} From 7ff5cbdd03b166bd1ceef63c56b6f65b12de6309 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:49:49 +0900 Subject: [PATCH 060/101] feat: add Alert Message and Confirm Message --- src/SectionManager/SectionManagerView.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index 08dc9c321..8d68f543e 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -46,4 +46,12 @@ export default class SectionManagerView { `).join('')} `; } + + static alertInputError() { + alert('invalid Error'); + } + + static confirmDelete() { + return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); + } } From dc4154b623b160a8c9bfa778317bb542917763ec Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:53:07 +0900 Subject: [PATCH 061/101] feat: add Id and Class Name into Tag --- src/SectionManager/SectionManagerView.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index 8d68f543e..9c159a95e 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -13,7 +13,7 @@ export default class SectionManagerView { const lines = JSON.parse(localStorage.getItem('Lines')); document.getElementById('section-select').innerHTML = `

    ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

    - ${Object.keys(lines).map((line) => ` `).join('')} + ${Object.keys(lines).map((line) => ` `).join('')} `; } @@ -22,11 +22,11 @@ export default class SectionManagerView { document.getElementById('section-input').innerHTML = `

    ${line} 관리

    ꡬ간 등둝

    - ${stations.map((station) => ``)} - - `; + + `; } static sectionTableView(line) { @@ -42,7 +42,7 @@ export default class SectionManagerView { ${stations.indexOf(station)} ${station} - + `).join('')} `; } From 9c0876f3106404073c35e50b2a239324a7cfe944 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 02:56:23 +0900 Subject: [PATCH 062/101] feat: add EventListener to SectionMangerController --- .../SectionManagerController.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/SectionManager/SectionManagerController.js diff --git a/src/SectionManager/SectionManagerController.js b/src/SectionManager/SectionManagerController.js new file mode 100644 index 000000000..bc1692879 --- /dev/null +++ b/src/SectionManager/SectionManagerController.js @@ -0,0 +1,31 @@ +import SectionManagerView from './SectionManagerView'; + +export default class SectionManagerController { + static buttonEventController() { + document.addEventListener('click', (event) => { + const eventId = event.target.id; + const eventClassName = event.target.className; + if (eventId === 'line-add-button') { + this.addButtonClicked(); + } else if (eventClassName === 'line-delete-button') { + const button = event.path[0]; + this.deleteButtonClicked(button); + } else if (eventClassName === 'section-line-menu-button') { + const button = event.path[0]; + this.sectionLineMenuClicked(button); + } + }); + } + + addButtonClicked() { + + } + + deleteButtonClicked() { + + } + + sectionLineMenuClicked() { + + } +} \ No newline at end of file From 6cc6cb07571c28d71f0aa03ad7a6a5836900c014 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 03:03:12 +0900 Subject: [PATCH 063/101] feat: show each Section Info when Section Menu Button Clicked --- src/SectionManager/SectionManagerController.js | 16 ++++++++++------ src/SectionManager/SectionManagerView.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/SectionManager/SectionManagerController.js b/src/SectionManager/SectionManagerController.js index bc1692879..7d59d32b1 100644 --- a/src/SectionManager/SectionManagerController.js +++ b/src/SectionManager/SectionManagerController.js @@ -1,4 +1,4 @@ -import SectionManagerView from './SectionManagerView'; +import SectionManagerView from './SectionManagerView.js'; export default class SectionManagerController { static buttonEventController() { @@ -17,15 +17,19 @@ export default class SectionManagerController { }); } - addButtonClicked() { + static addButtonClicked() { } - deleteButtonClicked() { + static deleteButtonClicked() { } - sectionLineMenuClicked() { - + static sectionLineMenuClicked(button) { + const buttons = document.getElementsByClassName('section-line-menu-button'); + const buttonsArray = Array.from(buttons); + const line = buttons[buttonsArray.indexOf(button)].dataset.menu; + SectionManagerView.sectionInputView(line); + SectionManagerView.sectionTableView(line); } -} \ No newline at end of file +} diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index 9c159a95e..f30134e7d 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -13,7 +13,7 @@ export default class SectionManagerView { const lines = JSON.parse(localStorage.getItem('Lines')); document.getElementById('section-select').innerHTML = `

    ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.

    - ${Object.keys(lines).map((line) => ` `).join('')} + ${Object.keys(lines).map((line) => ` `).join('')} `; } From 141294d688a2afdd4aac2419162866499faa28ef Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 03:32:32 +0900 Subject: [PATCH 064/101] feat: check Index is Valid --- src/SectionManager/SectionManagerModel.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/SectionManager/SectionManagerModel.js diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js new file mode 100644 index 000000000..4ed48ddd3 --- /dev/null +++ b/src/SectionManager/SectionManagerModel.js @@ -0,0 +1,14 @@ +export default class SectionManagerModel { + static isValidNumber(number) { + return (number !== '') && this.isValidRange(number) && this.isNumber(number); + } + + static isValidRange(number) { + const linesLength = Object.keys(JSON.parse(localStorage.getItem('Lines'))).length; + return linesLength + 1 >= number && number >= 0; + } + + static isNumber(number) { + return !/[^0-9]/.test(`${number}`); + } +} From d5553fff5dba4ef0cf951033d1ed2dc937197fe2 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 03:58:28 +0900 Subject: [PATCH 065/101] feat: add station to line --- .../SectionManagerController.js | 25 ++++++++++++++----- src/SectionManager/SectionManagerModel.js | 21 +++++++++++++--- src/SectionManager/SectionManagerView.js | 2 +- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/SectionManager/SectionManagerController.js b/src/SectionManager/SectionManagerController.js index 7d59d32b1..07fa222a7 100644 --- a/src/SectionManager/SectionManagerController.js +++ b/src/SectionManager/SectionManagerController.js @@ -1,24 +1,36 @@ import SectionManagerView from './SectionManagerView.js'; +import SectionManagerModel from './SectionManagerModel.js'; export default class SectionManagerController { static buttonEventController() { + let line = null; document.addEventListener('click', (event) => { const eventId = event.target.id; const eventClassName = event.target.className; - if (eventId === 'line-add-button') { - this.addButtonClicked(); - } else if (eventClassName === 'line-delete-button') { + if (eventId === 'section-add-button') { + this.addButtonClicked(line); + } else if (eventClassName === 'section-delete-button') { const button = event.path[0]; this.deleteButtonClicked(button); } else if (eventClassName === 'section-line-menu-button') { const button = event.path[0]; - this.sectionLineMenuClicked(button); + line = this.sectionLineMenuClicked(button); } }); } - static addButtonClicked() { - + static addButtonClicked(line) { + const index = document.getElementById('section-order-input').value; + const station = document.getElementById('section-station-selector').value; + if (!SectionManagerModel.isValidNumber(line, index) + || SectionManagerModel.isInLines(line, station)) { + SectionManagerView.alertInputError(); + SectionManagerView.sectionInputView(line); + } else { + SectionManagerModel.add(line, station, index); + SectionManagerView.sectionInputView(line); + SectionManagerView.sectionTableView(line); + } } static deleteButtonClicked() { @@ -31,5 +43,6 @@ export default class SectionManagerController { const line = buttons[buttonsArray.indexOf(button)].dataset.menu; SectionManagerView.sectionInputView(line); SectionManagerView.sectionTableView(line); + return line; } } diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index 4ed48ddd3..faf063b54 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -1,14 +1,27 @@ export default class SectionManagerModel { - static isValidNumber(number) { - return (number !== '') && this.isValidRange(number) && this.isNumber(number); + static isValidNumber(line, number) { + return (number !== '') && this.isValidRange(line, number) && this.isNumber(number); } - static isValidRange(number) { - const linesLength = Object.keys(JSON.parse(localStorage.getItem('Lines'))).length; + static isValidRange(line, number) { + const linesLength = JSON.parse(localStorage.getItem('Lines'))[line].length; return linesLength + 1 >= number && number >= 0; } static isNumber(number) { return !/[^0-9]/.test(`${number}`); } + + static isInLines(line, station) { + const lines = JSON.parse(localStorage.getItem('Lines'))[line]; + return lines.indexOf(station) > -1; + } + + static add(line, station, index) { + const linesJson = JSON.parse(localStorage.getItem('Lines')); + const lines = JSON.parse(localStorage.getItem('Lines'))[line]; + lines.splice(index, 0, station); + linesJson[line] = lines; + localStorage.setItem('Lines', JSON.stringify(linesJson)); + } } diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index f30134e7d..d6cd370f9 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -31,7 +31,7 @@ export default class SectionManagerView { static sectionTableView(line) { const lines = JSON.parse(localStorage.getItem('Lines')); - const stations = lines[line]; + const stations = lines[line]; document.getElementById('section-table').innerHTML = ` From 50133e7f4f0e52f38d9a90307f4dcdd03dc63d1b Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 04:11:14 +0900 Subject: [PATCH 066/101] feat: delete station from lines only when lines' elements number is more than 2 --- src/SectionManager/SectionManagerController.js | 15 ++++++++++++--- src/SectionManager/SectionManagerModel.js | 12 ++++++++++++ src/SectionManager/SectionManagerView.js | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/SectionManager/SectionManagerController.js b/src/SectionManager/SectionManagerController.js index 07fa222a7..4533e3d36 100644 --- a/src/SectionManager/SectionManagerController.js +++ b/src/SectionManager/SectionManagerController.js @@ -11,7 +11,7 @@ export default class SectionManagerController { this.addButtonClicked(line); } else if (eventClassName === 'section-delete-button') { const button = event.path[0]; - this.deleteButtonClicked(button); + this.deleteButtonClicked(line, button); } else if (eventClassName === 'section-line-menu-button') { const button = event.path[0]; line = this.sectionLineMenuClicked(button); @@ -33,8 +33,17 @@ export default class SectionManagerController { } } - static deleteButtonClicked() { - + static deleteButtonClicked(line, button) { + const buttons = document.getElementsByClassName('section-delete-button'); + const buttonsArray = Array.from(buttons); + const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; + if (SectionManagerModel.checkNumOfStations(line, station) + && SectionManagerView.confirmDelete()) { + SectionManagerModel.delete(line, station); + SectionManagerView.sectionTableView(line); + } else { + alert('μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.'); + } } static sectionLineMenuClicked(button) { diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index faf063b54..d19593a9a 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -24,4 +24,16 @@ export default class SectionManagerModel { linesJson[line] = lines; localStorage.setItem('Lines', JSON.stringify(linesJson)); } + + static checkNumOfStations(line) { + return JSON.parse(localStorage.getItem('Lines'))[line].length > 2; + } + + static delete(line, station) { + const linesJson = JSON.parse(localStorage.getItem('Lines')); + const lines = JSON.parse(localStorage.getItem('Lines'))[line]; + lines.splice(lines.indexOf(station), 1); + linesJson[line] = lines; + localStorage.setItem('Lines', JSON.stringify(linesJson)); + } } diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index d6cd370f9..91bdf8144 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -42,7 +42,7 @@ export default class SectionManagerView { - + `).join('')}
    μˆœμ„œ
    ${stations.indexOf(station)} ${station}
    `; } From 26273f7d5291b31f2a2928fa69268a6099879c15 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 04:17:06 +0900 Subject: [PATCH 067/101] faet: create MapPrintManger and import to MenuView --- src/MapPrintManager/MapPrintManagerView.js | 13 +++++++++++++ src/Menu/MenuView.js | 12 ++---------- 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 src/MapPrintManager/MapPrintManagerView.js diff --git a/src/MapPrintManager/MapPrintManagerView.js b/src/MapPrintManager/MapPrintManagerView.js new file mode 100644 index 000000000..deb2c311d --- /dev/null +++ b/src/MapPrintManager/MapPrintManagerView.js @@ -0,0 +1,13 @@ +export default class MapPrintManagerView { + static view() { + const lines = JSON.parse(localStorage.getItem('Lines')); + document.getElementById('sub-view-container').innerHTML = ` + ${Object.keys(lines).map((line) => ` +

    ${line}

    +
      +
    • ${lines[line][0]}
    • +
    • ${lines[line][(lines[line].length - 1)]}
    • +
    `).join('')} + `; + } +} diff --git a/src/Menu/MenuView.js b/src/Menu/MenuView.js index 7b34a080b..b5c96e47c 100644 --- a/src/Menu/MenuView.js +++ b/src/Menu/MenuView.js @@ -1,6 +1,7 @@ import StationManagerView from '../StationManger/StationManagerView.js' import LineManagerView from '../LineManger/LineManagerView.js'; import SectionManagerView from '../SectionManager/SectionManagerView.js'; +import MapPrintManagerView from '../MapPrintManager/MapPrintManagerView.js'; export default class MenuView { static menuButtonListView() { @@ -26,15 +27,6 @@ export default class MenuView { } static mapPrintManagerView() { - const stations = localStorage.getItem('Stations').split(','); - const lines = localStorage.getItem('Lines').split(','); - document.getElementById('sub-view-container').innerHTML = ` - ${lines.map((line) => ` -

    ${line}

    -
      -
    • ${stations[0]}
    • -
    • ${stations[stations.length - 1]}
    • -
    `).join('')} - `; + MapPrintManagerView.view(); } } From 38cc3a50dcb99aa839ee827a61dd00341e562c66 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 04:17:37 +0900 Subject: [PATCH 068/101] docs: update README.md --- docs/README.md | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/README.md b/docs/README.md index 0d1022083..92c79bb88 100644 --- a/docs/README.md +++ b/docs/README.md @@ -73,7 +73,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 전체 화면을 ν‘œμ‹œν•œλ‹€. (λ…Έμ„  μž…λ ₯ 및 λ…Έμ„  λͺ©λ‘) - [x] λ…Έμ„  μž…λ ₯ 화면을 κ°±μ‹ ν•œλ‹€. - [x] λ…Έμ„  λͺ©λ‘ 화면을 κ°±μ‹ ν•œλ‹€. - - [ ] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. * 확인 및 μ·¨μ†Œ λ²„νŠΌ 3. μ£Όμš” κΈ°λŠ₯ (Model) @@ -92,31 +92,32 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) - * 각 'λ…Έμ„ ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ν•΄λ‹Ή λ…Έμ„  관리 화면을 λ„μ›Œμ€„ 것을 μš”μ²­ν•œλ‹€. - * λ…Έμ„  관리 ν™”λ©΄μ—μ„œ '등둝' λ²„νŠΌμ„ 클릭할 경우 ꡬ간 λͺ©λ‘ 좔가와, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * λ…Έμ„  관리 ν™”λ©΄μ—μ„œ 'λ…Έμ„ μ—μ„œ 제거' λ²„νŠΌμ„ 클릭할 경우 μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή ꡬ간 μ‚­μ œμ™€, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ ꡬ간 μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] 각 'λ…Έμ„ ' λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ ν•΄λ‹Ή λ…Έμ„  관리 화면을 λ„μ›Œμ€„ 것을 μš”μ²­ν•œλ‹€. + - [x] λ…Έμ„  관리 ν™”λ©΄μ—μ„œ '등둝' λ²„νŠΌμ„ 클릭할 경우 ꡬ간 λͺ©λ‘ 좔가와, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] λ…Έμ„  관리 ν™”λ©΄μ—μ„œ 'λ…Έμ„ μ—μ„œ 제거' λ²„νŠΌμ„ 클릭할 경우 μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ '확인' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ λ…Έμ„  λͺ©λ‘μ—μ„œ ν•΄λ‹Ή ꡬ간 μ‚­μ œμ™€, ꡬ간 λͺ©λ‘ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” μ°½μ—μ„œ 'μ·¨μ†Œ' λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ ꡬ간 μž…λ ₯ ν™”λ©΄ 갱신을 μš”μ²­ν•œλ‹€. 2. ν™”λ©΄ ν‘œμ‹œ (View) - * μˆ˜μ •ν•  λ…Έμ„  화면을 ν‘œμ‹œν•œλ‹€. - * λ…Έμ„  관리 화면을 ν‘œμ‹œν•œλ‹€. - * λ…Έμ„  관리 화면을 κ°±μ‹ ν•œλ‹€. - * μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. - * μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] μˆ˜μ •ν•  λ…Έμ„  화면을 ν‘œμ‹œν•œλ‹€. + - [x] λ…Έμ„  관리 화면을 ν‘œμ‹œν•œλ‹€. + - [x] λ…Έμ„  관리 화면을 κ°±μ‹ ν•œλ‹€. + - [x] μž…λ ₯된 값이 잘λͺ»λ˜μ—ˆμŒμ„ κ²½κ³ ν•˜λŠ” 창을 λ„μš΄λ‹€. + - [x] μ‚­μ œ μ—¬λΆ€λ₯Ό ν™•μΈν•˜λŠ” 창을 λ„μš΄λ‹€. * 확인 및 μ·¨μ†Œ λ²„νŠΌ μΆ”κ°€ 3. μ£Όμš” κΈ°λŠ₯ (Model) - * μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μˆœμ„œ 값이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. - * μ˜ˆμ™Έ 처리 + - [x] μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μˆœμ„œ 값이 μœ νš¨ν•œμ§€ ν™•μΈν•œλ‹€. + - [x] μ˜ˆμ™Έ 처리 1. μˆœμ„œκ°€ 음수인 경우 μ˜ˆμ™Έμ²˜λ¦¬ 2. μˆœμ„œκ°€ μˆ«μžκ°€ μ•„λ‹Œ 경우 μ˜ˆμ™Έμ²˜λ¦¬ - * κΈ°μ‘΄ 노선에 μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€.(μ€‘λ³΅λœ 이름이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬) - * 노선에 ν¬ν•¨λœ 역이 λ‘κ°œ μ΄ν•˜μΈμ§€ ν™•μΈν•œλ‹€. - * 노선에 역을 μΆ”κ°€ν•œλ‹€. - * λ…Έμ„ μ—μ„œ 역을 μ‚­μ œν•œλ‹€. + 3. μˆœμ„œκ°€ λ²”μœ„λ₯Ό λ²—μ–΄λ‚˜λŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬ (예. 2κΉŒμ§€ μžˆλŠ”λ° 4에 μΆ”κ°€ν•˜λŠ” 경우) + - [x] κΈ°μ‘΄ 노선에 μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€.(μ€‘λ³΅λœ 이름이 μžˆλŠ” 경우 μ˜ˆμ™Έμ²˜λ¦¬) + - [x] 노선에 ν¬ν•¨λœ 역이 λ‘κ°œ μ΄ν•˜μΈμ§€ ν™•μΈν•œλ‹€. + - [x] 노선에 역을 μΆ”κ°€ν•œλ‹€. + - [x] λ…Έμ„ μ—μ„œ 역을 μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  노선도 관리 κΈ°λŠ₯ 1. ν™”λ©΄ν‘œμ‹œ (View) - * μ—­ λͺ©λ‘μ„ 좜λ ₯ν•œλ‹€. + - [x] μ—­ λͺ©λ‘μ„ 좜λ ₯ν•œλ‹€. ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ From 42fc65f273595b025d677026c0880caa8202f274 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 04:18:44 +0900 Subject: [PATCH 069/101] docs: update README.md --- docs/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/README.md b/docs/README.md index 92c79bb88..3492cd462 100644 --- a/docs/README.md +++ b/docs/README.md @@ -119,6 +119,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd 1. ν™”λ©΄ν‘œμ‹œ (View) - [x] μ—­ λͺ©λ‘μ„ 좜λ ₯ν•œλ‹€. +### κΈ°λŠ₯ μ—°κ²° +- [ ] κΈ°λŠ₯ μ—°κ²° + ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ * fix : 버그 μˆ˜μ • From e62d826d48d61a08b26259c354676c4b99f65d40 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 16:49:05 +0900 Subject: [PATCH 070/101] feat: link Modules for complete Service --- docs/README.md | 2 +- src/MapPrintManager/MapPrintManagerView.js | 12 ++++++------ src/Menu/MenuController.js | 6 ++++++ src/index.js | 18 ++++++++---------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/README.md b/docs/README.md index 3492cd462..2e3d9b55d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -120,7 +120,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] μ—­ λͺ©λ‘μ„ 좜λ ₯ν•œλ‹€. ### κΈ°λŠ₯ μ—°κ²° -- [ ] κΈ°λŠ₯ μ—°κ²° +- [x] κΈ°λŠ₯ μ—°κ²° ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ diff --git a/src/MapPrintManager/MapPrintManagerView.js b/src/MapPrintManager/MapPrintManagerView.js index deb2c311d..fbd1550f5 100644 --- a/src/MapPrintManager/MapPrintManagerView.js +++ b/src/MapPrintManager/MapPrintManagerView.js @@ -2,12 +2,12 @@ export default class MapPrintManagerView { static view() { const lines = JSON.parse(localStorage.getItem('Lines')); document.getElementById('sub-view-container').innerHTML = ` - ${Object.keys(lines).map((line) => ` -

    ${line}

    -
      -
    • ${lines[line][0]}
    • -
    • ${lines[line][(lines[line].length - 1)]}
    • -
    `).join('')} + ${Object.keys(lines).map((line) => `
    +

    ${line}

    +
      + ${lines[line].map((station) => `
    • ${station}
    • `).join('')} +
    `).join('')} +
    `; } } diff --git a/src/Menu/MenuController.js b/src/Menu/MenuController.js index 8252cb6b6..f76e1bfad 100644 --- a/src/Menu/MenuController.js +++ b/src/Menu/MenuController.js @@ -1,4 +1,7 @@ import MenuView from './MenuView.js'; +import StationManagerController from '../StationManger/StationManagerController.js'; +import LineManagerController from '../LineManger/LineManagerController.js' +import SectionManagerController from '../SectionManager/SectionManagerController.js'; export default class MenuController { static buttonEventController() { @@ -6,12 +9,15 @@ export default class MenuController { const eventId = event.target.id; if (eventId === 'station-manager-button') { MenuView.stationManagerView(); + StationManagerController.buttonEventController(); } if (eventId === 'line-manager-button') { MenuView.lineManagerView(); + LineManagerController.buttonEventController(); } if (eventId === 'section-manager-button') { MenuView.sectionManagerView(); + SectionManagerController.buttonEventController(); } if (eventId === 'map-print-manager-button') { MenuView.mapPrintManagerView(); diff --git a/src/index.js b/src/index.js index 2fd340c35..2a9f17fa8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,11 @@ import MenuView from './Menu/MenuView.js'; import MenuController from './Menu/MenuController.js'; -import StationMangerController from './StationManger/StationManagerController.js'; - -MenuView.menuButtonListView(); -MenuController.buttonEventController(); -StationMangerController.buttonEventController(); - -localStorage.setItem('Stations', ['인천', 'μ„œμšΈμ—­', '신도림', 'μ†Œμš”μ‚°']); -localStorage.setItem('Lines', ['1ν˜Έμ„ ', '2ν˜Έμ„ ', '3ν˜Έμ„ ']); - -console.log(localStorage.getItem('Lines')); +export default class SubwayManager { + constructor() { + MenuView.menuButtonListView(); + MenuController.buttonEventController(); + } +} + +new SubwayManager(); From 434fec7db28e79cfd09a46bf4e5e34647c9d6b1c Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Sat, 12 Dec 2020 16:50:02 +0900 Subject: [PATCH 071/101] docs: update README.md --- docs/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/README.md b/docs/README.md index 2e3d9b55d..b355d93d8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -122,6 +122,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd ### κΈ°λŠ₯ μ—°κ²° - [x] κΈ°λŠ₯ μ—°κ²° +### 기타 +- [ ] 둜컬 μŠ€ν† λ¦¬μ§€μ— 값이 μ—†λŠ” 경우 default κ°’ μ‚½μž…, μžˆλŠ” 경우 기쑴의 μŠ€ν† λ¦¬μ§€ 값을 이용. + ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ * fix : 버그 μˆ˜μ • From 76dce3682ae1cafac5ff021661e0c5aee0c114c7 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Mon, 14 Dec 2020 23:09:07 +0900 Subject: [PATCH 072/101] feat: set default value of Lines and Stations in Local Storage --- src/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.js b/src/index.js index 2a9f17fa8..b00bb1db6 100644 --- a/src/index.js +++ b/src/index.js @@ -3,9 +3,23 @@ import MenuController from './Menu/MenuController.js'; export default class SubwayManager { constructor() { + this.setLocalStrageDefault(); MenuView.menuButtonListView(); MenuController.buttonEventController(); } + + setLocalStrageDefault() { + const stationDefault = ['인천', 'μ„œμšΈμ—­', 'μ†Œμš”μ‚°', '신도림']; + const lineDefault = { + "1ν˜Έμ„ ": [stationDefault[0], stationDefault[1], stationDefault[2]], + "2ν˜Έμ„ ": [stationDefault[3], stationDefault[1]], + "3ν˜Έμ„ ": [stationDefault[2], stationDefault[0]], + }; + if (!(localStorage.getItem('Stations') && localStorage.getItem('Lines'))) { + localStorage.setItem('Stations', stationDefault); + localStorage.setItem('Lines', JSON.stringify(lineDefault)); + } + } } new SubwayManager(); From 3b72c09f991047fd2d759214750d02349d9ea2df Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Mon, 14 Dec 2020 23:09:56 +0900 Subject: [PATCH 073/101] docs: update README.md --- docs/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index b355d93d8..9301ff9e3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -123,7 +123,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] κΈ°λŠ₯ μ—°κ²° ### 기타 -- [ ] 둜컬 μŠ€ν† λ¦¬μ§€μ— 값이 μ—†λŠ” 경우 default κ°’ μ‚½μž…, μžˆλŠ” 경우 기쑴의 μŠ€ν† λ¦¬μ§€ 값을 이용. +- [x] 둜컬 μŠ€ν† λ¦¬μ§€μ— 값이 μ—†λŠ” 경우 default κ°’ μ‚½μž…, μžˆλŠ” 경우 기쑴의 μŠ€ν† λ¦¬μ§€ 값을 이용. + - 이경우 λ‘˜ 쀑 ν•˜λ‚˜μ— 값이 μ—†λŠ” κ²½μš°μ— λͺ¨λ‘ λ””ν΄νŠΈ κ°’μœΌλ‘œ μ„€μ •ν•˜λ„λ‘ 함. + - μ—­, λ…Έμ„  λ‚΄μ˜ μ—­ λͺ©λ‘κ°„μ˜ μ—°κ²°μ„± μœ μ§€λ₯Ό μœ„ν•¨. ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ From 2ad26ff66ed600d29a80737f199767414aaae5e3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Mon, 14 Dec 2020 23:37:46 +0900 Subject: [PATCH 074/101] docs: update README.md --- docs/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/README.md b/docs/README.md index 9301ff9e3..56e543b3c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -56,7 +56,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. + - [ ] ν•΄λ‹Ή 역이 ν¬ν•¨λœ 노선이 μ΅œμ†Œ μ—­ 쑰건 (2개 이상)을 λ§Œμ‘±ν•˜λŠ”μ§€ 확인 - [x] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [ ] 역을 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ‚­μ œν•œλ‹€. - [ ] κ³ λ €ν•΄μ•Ό ν•  사항 - λ§Œμ•½, 역이 ν•˜λ‚˜λ„ μ—†λ‹€λ©΄ μ–΄λ–»κ²Œ ν•  것인지? - μ΅œμ†Œ μ—­μ˜ 개수λ₯Ό μ§€μ •ν•  것인지 @@ -89,6 +91,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) - [x] 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - [x] 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. + - [ ] ν•΄λ‹Ή 노선에 λŒ€ν•œ 정보λ₯Ό ν•΄λ‹Ή 노선에 ν¬ν•¨λ˜μ–΄ 있던 μ—­μ˜ μ •λ³΄μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) @@ -126,6 +129,9 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 둜컬 μŠ€ν† λ¦¬μ§€μ— 값이 μ—†λŠ” 경우 default κ°’ μ‚½μž…, μžˆλŠ” 경우 기쑴의 μŠ€ν† λ¦¬μ§€ 값을 이용. - 이경우 λ‘˜ 쀑 ν•˜λ‚˜μ— 값이 μ—†λŠ” κ²½μš°μ— λͺ¨λ‘ λ””ν΄νŠΈ κ°’μœΌλ‘œ μ„€μ •ν•˜λ„λ‘ 함. - μ—­, λ…Έμ„  λ‚΄μ˜ μ—­ λͺ©λ‘κ°„μ˜ μ—°κ²°μ„± μœ μ§€λ₯Ό μœ„ν•¨. +- [ ] μ—­ - λ…Έμ„  κ°„ μ˜μ‘΄μ„± μΆ”κ°€ν•˜κΈ° + - [ ] 역이 μ‚­μ œλ  경우 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ—­ μ‚­μ œ +- [ ] 각 상황별 μ—λŸ¬ λ©”μ„Έμ§€ μΆ”κ°€ ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ From f5f725e4e7ad781c028df71522d31ab30e87921e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Mon, 14 Dec 2020 23:55:49 +0900 Subject: [PATCH 075/101] feat: set Default Value and change Data Structure of Staions and Lines --- src/index.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index b00bb1db6..7af3cbe72 100644 --- a/src/index.js +++ b/src/index.js @@ -3,22 +3,33 @@ import MenuController from './Menu/MenuController.js'; export default class SubwayManager { constructor() { + if (!(localStorage.getItem('Stations') && localStorage.getItem('Lines'))) { + this.setLocalStrageDefault(); + } this.setLocalStrageDefault(); + // console.log(JSON.parse(localStorage.getItem('Stations'))); + // console.log(JSON.parse(localStorage.getItem('Lines'))); MenuView.menuButtonListView(); MenuController.buttonEventController(); } setLocalStrageDefault() { - const stationDefault = ['인천', 'μ„œμšΈμ—­', 'μ†Œμš”μ‚°', '신도림']; + const stationDefault = { + "인천": { "lines": ["1ν˜Έμ„ ", "3ν˜Έμ„ "] }, + "μ„œμšΈμ—­": { "lines": ["1ν˜Έμ„ ", "2ν˜Έμ„ "] }, + "μ†Œμš”μ‚°": { "lines": ["1ν˜Έμ„ ", "3ν˜Έμ„ "] }, + "신도림": { "lines": ["2ν˜Έμ„ "] } + }; const lineDefault = { - "1ν˜Έμ„ ": [stationDefault[0], stationDefault[1], stationDefault[2]], - "2ν˜Έμ„ ": [stationDefault[3], stationDefault[1]], - "3ν˜Έμ„ ": [stationDefault[2], stationDefault[0]], + "1ν˜Έμ„ ": { "stations": ["인천", "μ„œμšΈμ—­", "μ†Œμš”μ‚°"] }, + "2ν˜Έμ„ ": { "stations": ["신도림", "μ„œμšΈμ—­"] }, + "3ν˜Έμ„ ": { "stations": ["μ†Œμš”μ‚°", "인천"] } }; - if (!(localStorage.getItem('Stations') && localStorage.getItem('Lines'))) { - localStorage.setItem('Stations', stationDefault); - localStorage.setItem('Lines', JSON.stringify(lineDefault)); - } + localStorage.setItem('Stations', JSON.stringify(stationDefault)); + localStorage.setItem('Lines', JSON.stringify(lineDefault)); + + console.log(JSON.parse(localStorage.getItem('Stations'))); + console.log(JSON.parse(localStorage.getItem('Lines'))); } } From 445cf5c786cdbba52296324233cf2bd3a4e85293 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 00:32:01 +0900 Subject: [PATCH 076/101] feat: edit StationManger Code by changed Data Structure --- src/StationManger/StationManagerModel.js | 24 +++++++++++------------- src/StationManger/StationManagerView.js | 6 +++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 73ff35960..32a8d2c2c 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -1,8 +1,9 @@ export default class StationManagerModel { static add(station) { - const stations = localStorage.getItem('Stations').split(','); - stations.push(station); - localStorage.setItem('Stations', stations); + const stations = JSON.parse(localStorage.getItem('Stations')); + stations[station] = { "lines": [] }; + localStorage.setItem('Stations', JSON.stringify(stations)); + console.log(JSON.parse(localStorage.getItem('Stations'))); } static isValidName(station) { @@ -12,8 +13,8 @@ export default class StationManagerModel { } static isDuplicated(station) { - const stations = localStorage.getItem('Stations').split(','); - return stations.indexOf(station) > -1; + const stations = JSON.parse(localStorage.getItem('Stations')); + return Object.keys(stations).indexOf(station) > -1; } static isSpace(station) { @@ -37,14 +38,11 @@ export default class StationManagerModel { } static delete(station) { - if (this.isInStations(station)) { - const stations = localStorage.getItem('Stations').split(','); - stations.splice(stations.indexOf(station), 1); - localStorage.setItem('Stations', stations); + if (this.isDuplicated(station)) { + const stations = JSON.parse(localStorage.getItem('Stations')); + delete stations[station]; + localStorage.setItem('Stations', JSON.stringify(stations)); + console.log(JSON.parse(localStorage.getItem('Stations'))); } } - - static isInStations(station) { - return localStorage.getItem('Stations').split(',').indexOf(station) > -1; - } } diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index d7dab5daa..5c14be290 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -21,7 +21,7 @@ export default class StationManagerView { } static stationTableView() { - const stations = localStorage.getItem('Stations').split(','); + const stations = JSON.parse(localStorage.getItem('Stations')); document.getElementById('station-table-view').innerHTML = `

    πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘

    @@ -29,7 +29,7 @@ export default class StationManagerView { - ${stations.map((station) => ` + ${Object.keys(stations).map((station) => ` @@ -44,4 +44,4 @@ export default class StationManagerView { static confirmDelete() { return window.confirm('μ •λ§λ‘œ μ‚­μ œ ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?'); } -} \ No newline at end of file +} From 6dec8a68aeaa8dd6b1590c21f1736e6b4da51df5 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 00:48:46 +0900 Subject: [PATCH 077/101] feat: edit LineManger Code by changed Data Structure --- src/LineManger/LineManagerController.js | 2 ++ src/LineManger/LineManagerModel.js | 13 ++++++++++++- src/LineManger/LineManagerView.js | 10 +++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 4a215c50f..3fe45b464 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -8,6 +8,7 @@ export default class LineManagerController { const eventId = event.target.id; const eventClassName = event.target.className; if (eventId === 'line-add-button') { + console.log('button'); this.addButtonClicked(); } else if (eventClassName === 'line-delete-button') { const button = event.path[0]; @@ -20,6 +21,7 @@ export default class LineManagerController { const line = document.getElementById('line-name-input').value; const lineStart = document.getElementById('line-start-station-selector').value; const lineEnd = document.getElementById('line-end-station-selector').value; + console.log('click'); if (!LineManagerModel.isValidName(line) || LineManagerModel.isSame(lineStart, lineEnd)) { LineManagerView.alertNameError(); LineManagerView.lineInputView(); diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 010cc2470..a326d084b 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -36,8 +36,19 @@ export default class LineManagerModel { static add(line, lineStart, lineEnd) { const lines = JSON.parse(localStorage.getItem('Lines')); - lines[line] = [lineStart, lineEnd]; + const stations = JSON.parse(localStorage.getItem('Stations')); + + lines[line] = { "stations": [lineStart, lineEnd] }; + if (stations[lineStart].lines.indexOf(line) < 0) { + stations[lineStart].lines.push(line); + } + if (stations[lineStart].lines.indexOf(line) < 0) { + stations[lineEnd].lines.push(line); + } localStorage.setItem('Lines', JSON.stringify(lines)); + localStorage.setItem('Stations', JSON.stringify(stations)); + console.log(JSON.parse(localStorage.getItem('Lines'))); + console.log(JSON.parse(localStorage.getItem('Stations'))); } static isInLines(line) { diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index 9e096c67f..feeae1385 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -12,17 +12,17 @@ export default class LineManagerView { } static lineInputView() { - const stations = localStorage.getItem('Stations').split(','); + const stations = JSON.parse(localStorage.getItem('Stations')); document.getElementById('line-input').innerHTML = `

    상행 쒅점

    ν•˜ν–‰ 쒅점

    `; @@ -41,8 +41,8 @@ export default class LineManagerView { ${Object.keys(lines).map((line) => `
    - - + + `).join('')}
    μ—­ 이름 μ„€μ •
    ${station}
    ${line}${lines[line][0]}${lines[line][(lines[line].length - 1)]}${lines[line].stations[0]}${lines[line].stations[(lines[line].stations.length - 1)]}
    `; From 7c6e5fdf2a4540ff2b93bc8472e98039acd423c3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 00:58:31 +0900 Subject: [PATCH 078/101] =?UTF-8?q?fix:=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=EB=84=88=EA=B0=80=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=EB=90=98=EC=96=B4=20=EC=95=A1=EC=85=98=EC=9D=B4=20=EC=97=AC?= =?UTF-8?q?=EB=9F=AC=EB=B2=88=20=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Menu/MenuController.js | 6 ------ src/index.js | 11 ++++++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Menu/MenuController.js b/src/Menu/MenuController.js index f76e1bfad..8252cb6b6 100644 --- a/src/Menu/MenuController.js +++ b/src/Menu/MenuController.js @@ -1,7 +1,4 @@ import MenuView from './MenuView.js'; -import StationManagerController from '../StationManger/StationManagerController.js'; -import LineManagerController from '../LineManger/LineManagerController.js' -import SectionManagerController from '../SectionManager/SectionManagerController.js'; export default class MenuController { static buttonEventController() { @@ -9,15 +6,12 @@ export default class MenuController { const eventId = event.target.id; if (eventId === 'station-manager-button') { MenuView.stationManagerView(); - StationManagerController.buttonEventController(); } if (eventId === 'line-manager-button') { MenuView.lineManagerView(); - LineManagerController.buttonEventController(); } if (eventId === 'section-manager-button') { MenuView.sectionManagerView(); - SectionManagerController.buttonEventController(); } if (eventId === 'map-print-manager-button') { MenuView.mapPrintManagerView(); diff --git a/src/index.js b/src/index.js index 7af3cbe72..19bdaf893 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,8 @@ import MenuView from './Menu/MenuView.js'; import MenuController from './Menu/MenuController.js'; +import StationManagerController from './StationManger/StationManagerController.js'; +import LineManagerController from './LineManger/LineManagerController.js'; +import SectionManagerController from './SectionManager/SectionManagerController.js'; export default class SubwayManager { constructor() { @@ -7,10 +10,11 @@ export default class SubwayManager { this.setLocalStrageDefault(); } this.setLocalStrageDefault(); - // console.log(JSON.parse(localStorage.getItem('Stations'))); - // console.log(JSON.parse(localStorage.getItem('Lines'))); MenuView.menuButtonListView(); MenuController.buttonEventController(); + SectionManagerController.buttonEventController(); + LineManagerController.buttonEventController(); + StationManagerController.buttonEventController(); } setLocalStrageDefault() { @@ -27,9 +31,6 @@ export default class SubwayManager { }; localStorage.setItem('Stations', JSON.stringify(stationDefault)); localStorage.setItem('Lines', JSON.stringify(lineDefault)); - - console.log(JSON.parse(localStorage.getItem('Stations'))); - console.log(JSON.parse(localStorage.getItem('Lines'))); } } From ae0bbc5b8c3f9220d42b5d62016675472332c3f1 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 02:12:04 +0900 Subject: [PATCH 079/101] feat: edit MapPrintManager Code by changed Data Structure --- src/MapPrintManager/MapPrintManagerView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MapPrintManager/MapPrintManagerView.js b/src/MapPrintManager/MapPrintManagerView.js index fbd1550f5..35eadda4e 100644 --- a/src/MapPrintManager/MapPrintManagerView.js +++ b/src/MapPrintManager/MapPrintManagerView.js @@ -5,7 +5,7 @@ export default class MapPrintManagerView { ${Object.keys(lines).map((line) => `

    ${line}

      - ${lines[line].map((station) => `
    • ${station}
    • `).join('')} + ${lines[line].stations.map((station) => `
    • ${station}
    • `).join('')}
    `).join('')}
    `; From dce0e4736054a25dfb8d40f4fe6ea6b9ff27c27e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 02:23:38 +0900 Subject: [PATCH 080/101] feat: edit SectionManager Code by changed Data Structure --- src/SectionManager/SectionManagerModel.js | 28 +++++++++++------------ src/SectionManager/SectionManagerView.js | 6 ++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index d19593a9a..4df75510a 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -4,7 +4,7 @@ export default class SectionManagerModel { } static isValidRange(line, number) { - const linesLength = JSON.parse(localStorage.getItem('Lines'))[line].length; + const linesLength = JSON.parse(localStorage.getItem('Lines'))[line].stations.length; return linesLength + 1 >= number && number >= 0; } @@ -13,27 +13,27 @@ export default class SectionManagerModel { } static isInLines(line, station) { - const lines = JSON.parse(localStorage.getItem('Lines'))[line]; - return lines.indexOf(station) > -1; + const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; + return stations.indexOf(station) > -1; } static add(line, station, index) { - const linesJson = JSON.parse(localStorage.getItem('Lines')); - const lines = JSON.parse(localStorage.getItem('Lines'))[line]; - lines.splice(index, 0, station); - linesJson[line] = lines; - localStorage.setItem('Lines', JSON.stringify(linesJson)); + const lines = JSON.parse(localStorage.getItem('Lines')); + const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; + stations.splice(index, 0, station); + lines[line].stations = stations; + localStorage.setItem('Lines', JSON.stringify(lines)); } static checkNumOfStations(line) { - return JSON.parse(localStorage.getItem('Lines'))[line].length > 2; + return JSON.parse(localStorage.getItem('Lines'))[line].stations.length > 2; } static delete(line, station) { - const linesJson = JSON.parse(localStorage.getItem('Lines')); - const lines = JSON.parse(localStorage.getItem('Lines'))[line]; - lines.splice(lines.indexOf(station), 1); - linesJson[line] = lines; - localStorage.setItem('Lines', JSON.stringify(linesJson)); + const lines = JSON.parse(localStorage.getItem('Lines')); + const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; + stations.splice(stations.indexOf(station), 1); + lines[line].stations = stations; + localStorage.setItem('Lines', JSON.stringify(lines)); } } diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index 91bdf8144..a20d26f4b 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -18,12 +18,12 @@ export default class SectionManagerView { } static sectionInputView(line) { - const stations = localStorage.getItem('Stations').split(','); + const stations = JSON.parse(localStorage.getItem('Stations')); document.getElementById('section-input').innerHTML = `

    ${line} 관리

    ꡬ간 등둝

    `; @@ -31,7 +31,7 @@ export default class SectionManagerView { static sectionTableView(line) { const lines = JSON.parse(localStorage.getItem('Lines')); - const stations = lines[line]; + const stations = lines[line].stations; document.getElementById('section-table').innerHTML = ` From 49fcb3ed71a9b3e53ae44d52d6fdd910cb1e2421 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 02:39:38 +0900 Subject: [PATCH 081/101] feat: check each Line has 2 more stations if delete --- src/StationManger/StationManagerModel.js | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 32a8d2c2c..ef2979669 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -38,11 +38,32 @@ export default class StationManagerModel { } static delete(station) { - if (this.isDuplicated(station)) { + if (this.isDuplicated(station) && this.checkAfterDelete(station)) { const stations = JSON.parse(localStorage.getItem('Stations')); + const lines = JSON.parse(localStorage.getItem('Lines')); + const linesOfStation = JSON.parse(localStorage.getItem('Stations'))[station].lines; delete stations[station]; + linesOfStation.forEach((line) => { + lines[line].stations.splice(lines[line].stations.indexOf(station), 1); + }); + localStorage.setItem('Lines', JSON.stringify(lines)); localStorage.setItem('Stations', JSON.stringify(stations)); - console.log(JSON.parse(localStorage.getItem('Stations'))); + } else { + // error + return 0; } } + + static checkAfterDelete(station) { + const lines = JSON.parse(localStorage.getItem('Lines')); + const linesOfStation = JSON.parse(localStorage.getItem('Stations'))[station].lines; + let isValid = true; + linesOfStation.forEach((line) => { + if (lines[line].stations.length <= 2) { + isValid = false; + return; + } + }); + return isValid; + } } From a47ce3fd31bc55d52a60ecbe898fc96e9419c348 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 02:40:31 +0900 Subject: [PATCH 082/101] docs: update README.md --- docs/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/README.md b/docs/README.md index 56e543b3c..997a26153 100644 --- a/docs/README.md +++ b/docs/README.md @@ -56,14 +56,14 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] κΈ°μ‘΄ μ—­ λͺ©λ‘μ— μ€‘λ³΅λœ 이름이 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] μ‚¬μš©μžκ°€ μ‚­μ œν•˜κΈ°λ‘œ μ„ νƒν•œ 역이 노선에 μžˆλŠ”μ§€ ν™•μΈν•œλ‹€. - [x] 역을 μ—­ λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - - [ ] ν•΄λ‹Ή 역이 ν¬ν•¨λœ 노선이 μ΅œμ†Œ μ—­ 쑰건 (2개 이상)을 λ§Œμ‘±ν•˜λŠ”μ§€ 확인 + - [x] ν•΄λ‹Ή 역이 ν¬ν•¨λœ 노선이 μ΅œμ†Œ μ—­ 쑰건 (2개 이상)을 λ§Œμ‘±ν•˜λŠ”μ§€ 확인 - [x] 역을 μ—­ λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. - - [ ] 역을 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ‚­μ œν•œλ‹€. - - [ ] κ³ λ €ν•΄μ•Ό ν•  사항 + - [x] 역을 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ‚­μ œν•œλ‹€. + - [x] κ³ λ €ν•΄μ•Ό ν•  사항 - λ§Œμ•½, 역이 ν•˜λ‚˜λ„ μ—†λ‹€λ©΄ μ–΄λ–»κ²Œ ν•  것인지? - μ΅œμ†Œ μ—­μ˜ 개수λ₯Ό μ§€μ •ν•  것인지 - - μ‚­μ œν–ˆμ„ λ•Œ 각 노선에 2개 μ΄ν•˜κ°€ λ˜λŠ” 곳이 있으면 μ‚­μ œλ₯Ό ν•˜μ§€ μ•Šμ„ 것인지. - - μ‚­μ œκ°€ λ˜μ§€ μ•ŠλŠ” 경우 κ²½κ³  창을 λ„μšΈ 것인지? + - μ‚­μ œν–ˆμ„ λ•Œ 각 노선에 2개 μ΄ν•˜κ°€ λ˜λŠ” 곳이 있으면 μ‚­μ œλ₯Ό ν•˜μ§€ μ•Šμ„ 것인지. => 채택 + - μ‚­μ œκ°€ λ˜μ§€ μ•ŠλŠ” 경우 κ²½κ³  창을 λ„μšΈ 것인지? => 채택 ### μ§€ν•˜μ²  λ…Έμ„  관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) @@ -91,7 +91,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 상행 쒅점역과 ν•˜ν–‰ 쒅점역이 같은 경우 μ˜ˆμ™Έμ²˜λ¦¬ ν•œλ‹€. (노선에 역이 ν•˜λ‚˜λΏμΈ 경우 μ˜ˆμ™Έμ²˜λ¦¬) - [x] 노선을 λ…Έμ„  λͺ©λ‘μ— μΆ”κ°€ν•œλ‹€. - [x] 노선을 λ…Έμ„  λͺ©λ‘μ—μ„œ μ‚­μ œν•œλ‹€. - - [ ] ν•΄λ‹Ή 노선에 λŒ€ν•œ 정보λ₯Ό ν•΄λ‹Ή 노선에 ν¬ν•¨λ˜μ–΄ 있던 μ—­μ˜ μ •λ³΄μ—μ„œ μ‚­μ œν•œλ‹€. + - [x] ν•΄λ‹Ή 노선에 λŒ€ν•œ 정보λ₯Ό ν•΄λ‹Ή 노선에 ν¬ν•¨λ˜μ–΄ 있던 μ—­μ˜ μ •λ³΄μ—μ„œ μ‚­μ œν•œλ‹€. ### μ§€ν•˜μ²  ꡬ간 관리 κΈ°λŠ₯ 1. 이벀트 관리 (Controller) @@ -129,8 +129,8 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - [x] 둜컬 μŠ€ν† λ¦¬μ§€μ— 값이 μ—†λŠ” 경우 default κ°’ μ‚½μž…, μžˆλŠ” 경우 기쑴의 μŠ€ν† λ¦¬μ§€ 값을 이용. - 이경우 λ‘˜ 쀑 ν•˜λ‚˜μ— 값이 μ—†λŠ” κ²½μš°μ— λͺ¨λ‘ λ””ν΄νŠΈ κ°’μœΌλ‘œ μ„€μ •ν•˜λ„λ‘ 함. - μ—­, λ…Έμ„  λ‚΄μ˜ μ—­ λͺ©λ‘κ°„μ˜ μ—°κ²°μ„± μœ μ§€λ₯Ό μœ„ν•¨. -- [ ] μ—­ - λ…Έμ„  κ°„ μ˜μ‘΄μ„± μΆ”κ°€ν•˜κΈ° - - [ ] 역이 μ‚­μ œλ  경우 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ—­ μ‚­μ œ +- [x] μ—­ - λ…Έμ„  κ°„ μ˜μ‘΄μ„± μΆ”κ°€ν•˜κΈ° + - [x] 역이 μ‚­μ œλ  경우 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ—­ μ‚­μ œ - [ ] 각 상황별 μ—λŸ¬ λ©”μ„Έμ§€ μΆ”κ°€ ## βœ”οΈ 컀밋 κ·œμΉ™ From 3df71648e3d0f28cf6675fe94f1d454506b85446 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 03:19:45 +0900 Subject: [PATCH 083/101] =?UTF-8?q?fix:=20=EC=97=AD=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=B0=8F=20=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EB=B0=98=EC=98=81=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LineManger/LineManagerModel.js | 8 +++++++- src/SectionManager/SectionManagerModel.js | 5 +++++ src/StationManger/StationManagerModel.js | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index a326d084b..28db8632d 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -42,7 +42,7 @@ export default class LineManagerModel { if (stations[lineStart].lines.indexOf(line) < 0) { stations[lineStart].lines.push(line); } - if (stations[lineStart].lines.indexOf(line) < 0) { + if (stations[lineEnd].lines.indexOf(line) < 0) { stations[lineEnd].lines.push(line); } localStorage.setItem('Lines', JSON.stringify(lines)); @@ -58,7 +58,13 @@ export default class LineManagerModel { static delete(line) { const lines = JSON.parse(localStorage.getItem('Lines')); + const stations = JSON.parse(localStorage.getItem('Stations')); + const stationsOfLines = lines[line].stations; + stationsOfLines.forEach((station) => { + stations[station].lines.splice(stations[station].lines.indexOf(line), 1); + }); delete lines[line]; + localStorage.setItem('Stations', JSON.stringify(stations)); localStorage.setItem('Lines', JSON.stringify(lines)); } } \ No newline at end of file diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index 4df75510a..d5c1401a0 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -20,8 +20,13 @@ export default class SectionManagerModel { static add(line, station, index) { const lines = JSON.parse(localStorage.getItem('Lines')); const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; + const stationJSON = JSON.parse(localStorage.getItem('Stations')); + if (stationJSON[station].lines.indexOf(line) < 0) { + stationJSON[station].lines.push(line); + } stations.splice(index, 0, station); lines[line].stations = stations; + localStorage.setItem('Stations', JSON.stringify(stationJSON)); localStorage.setItem('Lines', JSON.stringify(lines)); } diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index ef2979669..61c9e62ac 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -41,11 +41,11 @@ export default class StationManagerModel { if (this.isDuplicated(station) && this.checkAfterDelete(station)) { const stations = JSON.parse(localStorage.getItem('Stations')); const lines = JSON.parse(localStorage.getItem('Lines')); - const linesOfStation = JSON.parse(localStorage.getItem('Stations'))[station].lines; - delete stations[station]; + const linesOfStation = stations[station].lines; linesOfStation.forEach((line) => { lines[line].stations.splice(lines[line].stations.indexOf(station), 1); }); + delete stations[station]; localStorage.setItem('Lines', JSON.stringify(lines)); localStorage.setItem('Stations', JSON.stringify(stations)); } else { From ec002a06291dacdfa334417db9ac9fc2f8fea375 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 03:28:26 +0900 Subject: [PATCH 084/101] feat: add Error Msg for StationManager --- src/StationManger/StationErrorMsg.js | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/StationManger/StationErrorMsg.js diff --git a/src/StationManger/StationErrorMsg.js b/src/StationManger/StationErrorMsg.js new file mode 100644 index 000000000..49e0b0620 --- /dev/null +++ b/src/StationManger/StationErrorMsg.js @@ -0,0 +1,36 @@ +export default class StationErrorMsg { + /* + * INPUT ERROR + */ + static lengthError() { + return 'μ—­ 이름은 2κΈ€μž μ΄μƒμœΌλ‘œ μž‘μ„±ν•΄ μ£Όμ„Έμš”.\n'; + } + + static spaceError() { + return 'μ—­ 이름 μ‚¬μ΄μ—λŠ” 곡백이 λ“€μ–΄κ°ˆ 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + + static characterError() { + return 'μ™„μ „ν•œ ν•œκΈ€ λ‹¨μ–΄λ‘œ μž…λ ₯ν•΄ μ£Όμ„Έμš”.\nex. ㅏ역 (x) λ‹€μ—­ (o)\n'; + } + + static languageError() { + return 'μ—­ 이름은 ν•œκΈ€λ‘œλ§Œ μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.\n'; + } + + static specialCharError() { + return 'μ—­ μ΄λ¦„μ—λŠ” 특수 λ¬Έμžκ°€ λ“€μ–΄ 갈 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + + static duplicateError() { + return '이미 ν•΄λ‹Ή μ΄λ¦„μ˜ 역이 μ‘΄μž¬ν•©λ‹ˆλ‹€.\n'; + } + + /* + * DELETE ERROR + */ + + static stationNumberError() { + return 'ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„  쀑, 포함 된 역이 3개 미만인 역이 μžˆμ–΄ μ‚­μ œκ°€ λΆˆκ°€λŠ₯ ν•©λ‹ˆλ‹€.'; + } +} From 6b65539d592a4830dd919f7e940382654ad07286 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 03:50:47 +0900 Subject: [PATCH 085/101] feat: show Error Msg for each Error --- src/StationManger/StationErrorMsg.js | 18 ++++++++ src/StationManger/StationManagerController.js | 19 ++++++-- src/StationManger/StationManagerModel.js | 46 +++++++++++-------- src/StationManger/StationManagerView.js | 6 ++- 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/StationManger/StationErrorMsg.js b/src/StationManger/StationErrorMsg.js index 49e0b0620..0d3e3d6c8 100644 --- a/src/StationManger/StationErrorMsg.js +++ b/src/StationManger/StationErrorMsg.js @@ -1,4 +1,18 @@ export default class StationErrorMsg { + static error(number) { + const errorMsg = [ + this.lengthError(), + this.spaceError(), + this.characterError(), + this.languageError(), + this.specialCharError(), + this.duplicateError(), + this.stationNumberError(), + this.cancelDeleteError(), + ]; + return errorMsg[number * (-1)]; + } + /* * INPUT ERROR */ @@ -33,4 +47,8 @@ export default class StationErrorMsg { static stationNumberError() { return 'ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„  쀑, 포함 된 역이 3개 미만인 역이 μžˆμ–΄ μ‚­μ œκ°€ λΆˆκ°€λŠ₯ ν•©λ‹ˆλ‹€.'; } + + static cancelDeleteError() { + return 'μ‚­μ œλ₯Ό μ·¨μ†Œν–ˆμŠ΅λ‹ˆλ‹€.'; + } } diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 368945e56..d1ab981b4 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -1,5 +1,6 @@ import StationManagerView from './StationManagerView.js'; import StationManagerModel from './StationManagerModel.js'; +import StationErrorMsg from './StationErrorMsg.js'; export default class StationManagerController { static buttonEventController() { @@ -17,8 +18,9 @@ export default class StationManagerController { static addButtonClicked() { const station = document.getElementById('station-name-input').value; - if (!StationManagerModel.isValidName(station)) { - StationManagerView.alertNameError(); + const isValid = StationManagerModel.isValidName(station); + if (isValid !== 1) { + StationManagerView.alertNameError(isValid); StationManagerView.stationInputView(); return; } @@ -31,9 +33,16 @@ export default class StationManagerController { const buttons = document.getElementsByClassName('station-delete-button'); const buttonsArray = Array.from(buttons); const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - if (StationManagerView.confirmDelete()) { - StationManagerModel.delete(station); - StationManagerView.stationTableView(); + const isValid = StationManagerModel.checkAfterDelete(station); + if (isValid !== 1) { + StationManagerView.alertNameError(isValid); + return; + } + if (!StationManagerView.confirmDelete()) { + StationManagerView.alertNameError(-7); + return; } + StationManagerModel.delete(station); + StationManagerView.stationTableView(); } } diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 61c9e62ac..bc5e0252c 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -7,9 +7,21 @@ export default class StationManagerModel { } static isValidName(station) { - return (!this.isDuplicated(station) && !this.isSpace(station) && !this.isEnglish(station) - && !this.isSpecialChar(station) && !this.isValidLength(station) - && !this.isSingleKoreanAlphabet(station)); + let isValid = 1; + const validationCheckFunction = [ + this.isValidLength(station), + this.isSpace(station), + this.isSingleKoreanAlphabet(station), + this.isEnglish(station), + this.isSpecialChar(station), + this.isDuplicated(station), + ]; + validationCheckFunction.forEach((func, index) => { + if (func) { + isValid = (-1) * index; + } + }); + return isValid; } static isDuplicated(station) { @@ -38,30 +50,24 @@ export default class StationManagerModel { } static delete(station) { - if (this.isDuplicated(station) && this.checkAfterDelete(station)) { - const stations = JSON.parse(localStorage.getItem('Stations')); - const lines = JSON.parse(localStorage.getItem('Lines')); - const linesOfStation = stations[station].lines; - linesOfStation.forEach((line) => { - lines[line].stations.splice(lines[line].stations.indexOf(station), 1); - }); - delete stations[station]; - localStorage.setItem('Lines', JSON.stringify(lines)); - localStorage.setItem('Stations', JSON.stringify(stations)); - } else { - // error - return 0; - } + const stations = JSON.parse(localStorage.getItem('Stations')); + const lines = JSON.parse(localStorage.getItem('Lines')); + const linesOfStation = stations[station].lines; + linesOfStation.forEach((line) => { + lines[line].stations.splice(lines[line].stations.indexOf(station), 1); + }); + delete stations[station]; + localStorage.setItem('Lines', JSON.stringify(lines)); + localStorage.setItem('Stations', JSON.stringify(stations)); } static checkAfterDelete(station) { const lines = JSON.parse(localStorage.getItem('Lines')); const linesOfStation = JSON.parse(localStorage.getItem('Stations'))[station].lines; - let isValid = true; + let isValid = 1; linesOfStation.forEach((line) => { if (lines[line].stations.length <= 2) { - isValid = false; - return; + isValid = -6; } }); return isValid; diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index 5c14be290..0d248de6b 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -1,3 +1,5 @@ +import StationErrorMsg from './StationErrorMsg.js'; + export default class StationManagerView { static view() { this.stationInitView(); @@ -37,8 +39,8 @@ export default class StationManagerView {
    μˆœμ„œ
    `; } - static alertNameError() { - alert('invalid Error'); + static alertNameError(errorNum) { + alert(StationErrorMsg.error(errorNum)); } static confirmDelete() { From 9ddf96b4f3d2c37e9facb7b5a0d1d020e3577116 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:16:58 +0900 Subject: [PATCH 086/101] feat: add Error Msg for Line Input Error --- src/LineManger/LineErrorMsg.js | 55 +++++++++++++++++++++++++ src/LineManger/LineManagerController.js | 7 ++-- src/LineManger/LineManagerModel.js | 31 +++++++++----- src/LineManger/LineManagerView.js | 6 ++- 4 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 src/LineManger/LineErrorMsg.js diff --git a/src/LineManger/LineErrorMsg.js b/src/LineManger/LineErrorMsg.js new file mode 100644 index 000000000..f806a7d89 --- /dev/null +++ b/src/LineManger/LineErrorMsg.js @@ -0,0 +1,55 @@ +export default class LineErrorMsg { + static error(number) { + const errorMsg = [ + this.lengthError(), + this.spaceError(), + this.characterError(), + this.languageError(), + this.specialCharError(), + this.duplicateError(), + this.sameStartEndError(), + this.cancelDeleteError(), + ]; + return errorMsg[number * (-1)]; + } + + /* + * INPUT ERROR + */ + + static lengthError() { + return 'λ…Έμ„  이름은 2κΈ€μž μ΄μƒμœΌλ‘œ μž‘μ„±ν•΄ μ£Όμ„Έμš”.\n'; + } + + static spaceError() { + return 'λ…Έμ„  이름 μ‚¬μ΄μ—λŠ” 곡백이 λ“€μ–΄κ°ˆ 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + + static characterError() { + return 'μ™„μ „ν•œ ν•œκΈ€ λ‹¨μ–΄λ‘œ μž…λ ₯ν•΄ μ£Όμ„Έμš”.\nex. ㅏ역 (x) λ‹€μ—­ (o)\n'; + } + + static languageError() { + return 'λ…Έμ„  이름은 ν•œκΈ€λ‘œλ§Œ μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.\n'; + } + + static specialCharError() { + return 'λ…Έμ„  μ΄λ¦„μ—λŠ” 특수 λ¬Έμžκ°€ λ“€μ–΄ 갈 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + + static duplicateError() { + return '이미 ν•΄λ‹Ή μ΄λ¦„μ˜ 노선이 μ‘΄μž¬ν•©λ‹ˆλ‹€.\n'; + } + + static sameStartEndError() { + return '상행선 쒅점과 ν•˜ν–‰μ„  쒅점은 같을 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + + /* + * DELETE ERROR + */ + + static cancelDeleteError() { + return 'μ‚­μ œλ₯Ό μ·¨μ†Œν–ˆμŠ΅λ‹ˆλ‹€.'; + } +} diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index 3fe45b464..abdc1bd63 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -8,7 +8,6 @@ export default class LineManagerController { const eventId = event.target.id; const eventClassName = event.target.className; if (eventId === 'line-add-button') { - console.log('button'); this.addButtonClicked(); } else if (eventClassName === 'line-delete-button') { const button = event.path[0]; @@ -21,9 +20,9 @@ export default class LineManagerController { const line = document.getElementById('line-name-input').value; const lineStart = document.getElementById('line-start-station-selector').value; const lineEnd = document.getElementById('line-end-station-selector').value; - console.log('click'); - if (!LineManagerModel.isValidName(line) || LineManagerModel.isSame(lineStart, lineEnd)) { - LineManagerView.alertNameError(); + const isValid = LineManagerModel.isValidInput(line, lineStart, lineEnd); + if (isValid !== 1) { + LineManagerView.alertNameError(isValid); LineManagerView.lineInputView(); return; } diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 28db8632d..563c1509e 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -1,8 +1,25 @@ export default class LineManagerModel { - static isValidName(line) { - return (!this.isDuplicated(line) && !this.isSpace(line) && !this.isEnglish(line) - && !this.isSpecialChar(line) && !this.isValidLength(line) - && !this.isSingleKoreanAlphabet(line)); + static isValidInput(line, lineStart, lineEnd) { + let isValid = 1; + const validationCheckFunction = [ + this.isValidLength(line), + this.isSpace(line), + this.isSingleKoreanAlphabet(line), + this.isEnglish(line), + this.isSpecialChar(line), + this.isDuplicated(line), + this.isSame(lineStart, lineEnd), + ]; + validationCheckFunction.forEach((func, index) => { + if (func && isValid === 1) { + isValid = (-1) * index; + } + }); + return isValid; + } + + static isValidLength(line) { + return line.length < 2; } static isDuplicated(line) { @@ -22,10 +39,6 @@ export default class LineManagerModel { return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(line); } - static isValidLength(line) { - return line.length < 2; - } - static isSingleKoreanAlphabet(line) { return /[^κ°€-힣a-z0-9]/.test(line); } @@ -47,8 +60,6 @@ export default class LineManagerModel { } localStorage.setItem('Lines', JSON.stringify(lines)); localStorage.setItem('Stations', JSON.stringify(stations)); - console.log(JSON.parse(localStorage.getItem('Lines'))); - console.log(JSON.parse(localStorage.getItem('Stations'))); } static isInLines(line) { diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index feeae1385..c4e5bc07a 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -1,3 +1,5 @@ +import LineErrorMsg from './LineErrorMsg.js'; + export default class LineManagerView { static view() { document.getElementById('sub-view-container').innerHTML = ` @@ -48,8 +50,8 @@ export default class LineManagerView { `; } - static alertNameError() { - alert('invalid Error'); + static alertNameError(errorNum) { + alert(LineErrorMsg.error(errorNum)); } static confirmDelete() { From 33831da84d4050485f5ce32c20574bb6264368a3 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:22:01 +0900 Subject: [PATCH 087/101] feat: add Error Msg for Delete Cancel --- src/LineManger/LineManagerController.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index abdc1bd63..f26fff8d7 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -1,6 +1,5 @@ import LineManagerView from './LineManagerView.js'; import LineManagerModel from './LineManagerModel.js'; -import StationManagerView from '../StationManger/StationManagerView.js'; export default class LineManagerController { static buttonEventController() { @@ -9,7 +8,8 @@ export default class LineManagerController { const eventClassName = event.target.className; if (eventId === 'line-add-button') { this.addButtonClicked(); - } else if (eventClassName === 'line-delete-button') { + } + if (eventClassName === 'line-delete-button') { const button = event.path[0]; this.deleteButtonClicked(button); } @@ -35,9 +35,11 @@ export default class LineManagerController { const buttons = document.getElementsByClassName('line-delete-button'); const buttonsArray = Array.from(buttons); const line = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - if (LineManagerModel.isInLines(line) && StationManagerView.confirmDelete()) { - LineManagerModel.delete(line); - LineManagerView.lineTableView(); + if (!LineManagerView.confirmDelete()) { + LineManagerView.alertNameError(-7); + return; } + LineManagerModel.delete(line); + LineManagerView.lineTableView(); } -} \ No newline at end of file +} From 3d4710a50a9c5a059993470f9d74621b644c50c2 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:39:20 +0900 Subject: [PATCH 088/101] feat: add Errom Msg for SectionManager --- src/SectionManager/SectionErrorMsg.js | 35 +++++++++++++++++++ .../SectionManagerController.js | 27 ++++++++------ src/SectionManager/SectionManagerModel.js | 10 ++++++ src/SectionManager/SectionManagerView.js | 6 ++-- 4 files changed, 65 insertions(+), 13 deletions(-) create mode 100644 src/SectionManager/SectionErrorMsg.js diff --git a/src/SectionManager/SectionErrorMsg.js b/src/SectionManager/SectionErrorMsg.js new file mode 100644 index 000000000..1bc1bff03 --- /dev/null +++ b/src/SectionManager/SectionErrorMsg.js @@ -0,0 +1,35 @@ +export default class SectionErrorMsg { + static error(number) { + const errorMsg = [ + this.lengthError(), + this.duplicateError(), + this.stationNumberError(), + this.cancelDeleteError(), + ]; + return errorMsg[number * (-1)]; + } + + /* + * INPUT ERROR + */ + + static lengthError() { + return 'μˆœμ„œλŠ” 0 μ΄μƒμ˜ μ •μˆ˜λ§Œ μž…λ ₯ν•  수 μžˆμŠ΅λ‹ˆλ‹€.\nμ΅œλŒ€ μž…λ ₯ μˆœμ„œ λ²ˆν˜ΈλŠ” λ§ˆμ§€λ§‰ μˆœμ„œ 번호 + 1 μž…λ‹ˆλ‹€.\n'; + } + + static duplicateError() { + return '이미 ν•΄λ‹Ή 역이 노선에 μ‘΄μž¬ν•©λ‹ˆλ‹€.\n'; + } + + /* + * DELETE ERROR + */ + + static stationNumberError() { + return 'ν¬ν•¨λœ 노선이 2개 μ΄ν•˜λ‘œ μ—­ μ‚­μ œκ°€ λΆˆκ°€λŠ₯ ν•©λ‹ˆλ‹€.'; + } + + static cancelDeleteError() { + return 'μ‚­μ œλ₯Ό μ·¨μ†Œν–ˆμŠ΅λ‹ˆλ‹€.'; + } +} diff --git a/src/SectionManager/SectionManagerController.js b/src/SectionManager/SectionManagerController.js index 4533e3d36..73c74f507 100644 --- a/src/SectionManager/SectionManagerController.js +++ b/src/SectionManager/SectionManagerController.js @@ -22,28 +22,33 @@ export default class SectionManagerController { static addButtonClicked(line) { const index = document.getElementById('section-order-input').value; const station = document.getElementById('section-station-selector').value; - if (!SectionManagerModel.isValidNumber(line, index) - || SectionManagerModel.isInLines(line, station)) { - SectionManagerView.alertInputError(); - SectionManagerView.sectionInputView(line); - } else { + const isValid = SectionManagerModel.isValidInput(line, index, station); + if (isValid === 1) { SectionManagerModel.add(line, station, index); SectionManagerView.sectionInputView(line); SectionManagerView.sectionTableView(line); } + if (isValid !== 1) { + SectionManagerView.alertInputError(isValid); + SectionManagerView.sectionInputView(line); + } } static deleteButtonClicked(line, button) { const buttons = document.getElementsByClassName('section-delete-button'); const buttonsArray = Array.from(buttons); const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; - if (SectionManagerModel.checkNumOfStations(line, station) - && SectionManagerView.confirmDelete()) { - SectionManagerModel.delete(line, station); - SectionManagerView.sectionTableView(line); - } else { - alert('μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.'); + const isValid = SectionManagerModel.checkNumOfStations(line, station); + if (isValid === false) { + SectionManagerView.alertInputError(-2); + return; + } + if (!SectionManagerView.confirmDelete()) { + SectionManagerView.alertInputError(-3); + return; } + SectionManagerModel.delete(line, station); + SectionManagerView.sectionTableView(line); } static sectionLineMenuClicked(button) { diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index d5c1401a0..d4fe369f7 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -1,4 +1,14 @@ export default class SectionManagerModel { + static isValidInput(line, index, station) { + if (!SectionManagerModel.isValidNumber(line, index)) { + return 0; + } + if (SectionManagerModel.isInLines(line, station)) { + return -1; + } + return 1; + } + static isValidNumber(line, number) { return (number !== '') && this.isValidRange(line, number) && this.isNumber(number); } diff --git a/src/SectionManager/SectionManagerView.js b/src/SectionManager/SectionManagerView.js index a20d26f4b..88fbd302c 100644 --- a/src/SectionManager/SectionManagerView.js +++ b/src/SectionManager/SectionManagerView.js @@ -1,3 +1,5 @@ +import SectionErrorMsg from './SectionErrorMsg.js'; + export default class SectionManagerView { static view() { document.getElementById('sub-view-container').innerHTML = ` @@ -47,8 +49,8 @@ export default class SectionManagerView { `; } - static alertInputError() { - alert('invalid Error'); + static alertInputError(errorNum) { + alert(SectionErrorMsg.error(errorNum)); } static confirmDelete() { From 10b7f12814efe902683a5fbdd8102f2d16827136 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:40:28 +0900 Subject: [PATCH 089/101] feat: delete unnecessary module import --- src/StationManger/StationManagerController.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index d1ab981b4..42dd9cd97 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -1,6 +1,5 @@ import StationManagerView from './StationManagerView.js'; import StationManagerModel from './StationManagerModel.js'; -import StationErrorMsg from './StationErrorMsg.js'; export default class StationManagerController { static buttonEventController() { From 84984d1a48ec80559aca07f75b3e168b3e67b2b8 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:41:10 +0900 Subject: [PATCH 090/101] docs: update README.md --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 997a26153..5f17fec9e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -131,7 +131,7 @@ git clone https://github.com/sunhpark42/javascript-subway-map-precourse.git; cd - μ—­, λ…Έμ„  λ‚΄μ˜ μ—­ λͺ©λ‘κ°„μ˜ μ—°κ²°μ„± μœ μ§€λ₯Ό μœ„ν•¨. - [x] μ—­ - λ…Έμ„  κ°„ μ˜μ‘΄μ„± μΆ”κ°€ν•˜κΈ° - [x] 역이 μ‚­μ œλ  경우 ν•΄λ‹Ή 역이 ν¬ν•¨λœ λ…Έμ„ μ—μ„œ μ—­ μ‚­μ œ -- [ ] 각 상황별 μ—λŸ¬ λ©”μ„Έμ§€ μΆ”κ°€ +- [x] 각 상황별 μ—λŸ¬ λ©”μ„Έμ§€ μΆ”κ°€ ## βœ”οΈ 컀밋 κ·œμΉ™ * feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ From db447b8f8d5237a79478862d581b93c7399792e5 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 18:56:21 +0900 Subject: [PATCH 091/101] feat: add only Number Error of Station Input --- src/StationManger/StationErrorMsg.js | 5 +++++ src/StationManger/StationManagerController.js | 2 +- src/StationManger/StationManagerModel.js | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/StationManger/StationErrorMsg.js b/src/StationManger/StationErrorMsg.js index 0d3e3d6c8..fe2e1bb66 100644 --- a/src/StationManger/StationErrorMsg.js +++ b/src/StationManger/StationErrorMsg.js @@ -7,6 +7,7 @@ export default class StationErrorMsg { this.languageError(), this.specialCharError(), this.duplicateError(), + this.onlyNumberError(), this.stationNumberError(), this.cancelDeleteError(), ]; @@ -40,6 +41,10 @@ export default class StationErrorMsg { return '이미 ν•΄λ‹Ή μ΄λ¦„μ˜ 역이 μ‘΄μž¬ν•©λ‹ˆλ‹€.\n'; } + static onlyNumberError() { + return 'μ—­ 이름은 숫자둜만 이루어 질 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + /* * DELETE ERROR */ diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 42dd9cd97..02e503dc0 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -38,7 +38,7 @@ export default class StationManagerController { return; } if (!StationManagerView.confirmDelete()) { - StationManagerView.alertNameError(-7); + StationManagerView.alertNameError(-8); return; } StationManagerModel.delete(station); diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index bc5e0252c..d125db5c7 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -15,6 +15,7 @@ export default class StationManagerModel { this.isEnglish(station), this.isSpecialChar(station), this.isDuplicated(station), + this.isOnlyNumber(station), ]; validationCheckFunction.forEach((func, index) => { if (func) { @@ -46,11 +47,14 @@ export default class StationManagerModel { } static isSingleKoreanAlphabet(station) { - return /[^κ°€-힣]/.test(station); + return /[^κ°€-힣a-x0-9]/.test(station); + } + + static isOnlyNumber(station) { + return Number.isNaN(station); } static delete(station) { - const stations = JSON.parse(localStorage.getItem('Stations')); const lines = JSON.parse(localStorage.getItem('Lines')); const linesOfStation = stations[station].lines; linesOfStation.forEach((line) => { @@ -67,7 +71,7 @@ export default class StationManagerModel { let isValid = 1; linesOfStation.forEach((line) => { if (lines[line].stations.length <= 2) { - isValid = -6; + isValid = -7; } }); return isValid; From 97d6398b1e59de6b6c7834fc01e055d2de417526 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 21:13:31 +0900 Subject: [PATCH 092/101] fix: load Stations Data on Station Delete Function --- src/StationManger/StationManagerModel.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index d125db5c7..cfec2f363 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -51,10 +51,11 @@ export default class StationManagerModel { } static isOnlyNumber(station) { - return Number.isNaN(station); + return /[^0-9]/.test(station); // 숫자λ₯Ό μ œμ™Έν•œ λ¬Έμžμ—΄μ΄ μžˆλŠ” 경우 true } static delete(station) { + const stations = JSON.parse(localStorage.getItem('Stations')); const lines = JSON.parse(localStorage.getItem('Lines')); const linesOfStation = stations[station].lines; linesOfStation.forEach((line) => { From 3306ff3f97bd35d6179694fbe50daf37e2235db5 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 21:15:21 +0900 Subject: [PATCH 093/101] feat: add Error when Station Name consists of only Number --- src/StationManger/StationManagerController.js | 1 + src/StationManger/StationManagerModel.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 02e503dc0..614d5fef1 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -18,6 +18,7 @@ export default class StationManagerController { static addButtonClicked() { const station = document.getElementById('station-name-input').value; const isValid = StationManagerModel.isValidName(station); + console.log(isValid); if (isValid !== 1) { StationManagerView.alertNameError(isValid); StationManagerView.stationInputView(); diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index cfec2f363..7810168d3 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -51,7 +51,7 @@ export default class StationManagerModel { } static isOnlyNumber(station) { - return /[^0-9]/.test(station); // 숫자λ₯Ό μ œμ™Έν•œ λ¬Έμžμ—΄μ΄ μžˆλŠ” 경우 true + return !(/[^0-9]/.test(station)); } static delete(station) { From 7749ccf8397d13a0e5546cea59e3c78af6bdb5e1 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 21:16:51 +0900 Subject: [PATCH 094/101] feat: add Error when Line Name consists of only Number --- src/LineManger/LineErrorMsg.js | 5 +++++ src/LineManger/LineManagerController.js | 2 +- src/LineManger/LineManagerModel.js | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/LineManger/LineErrorMsg.js b/src/LineManger/LineErrorMsg.js index f806a7d89..7b06c9455 100644 --- a/src/LineManger/LineErrorMsg.js +++ b/src/LineManger/LineErrorMsg.js @@ -7,6 +7,7 @@ export default class LineErrorMsg { this.languageError(), this.specialCharError(), this.duplicateError(), + this.onlyNumberError(), this.sameStartEndError(), this.cancelDeleteError(), ]; @@ -41,6 +42,10 @@ export default class LineErrorMsg { return '이미 ν•΄λ‹Ή μ΄λ¦„μ˜ 노선이 μ‘΄μž¬ν•©λ‹ˆλ‹€.\n'; } + static onlyNumberError() { + return 'λ…Έμ„  이름은 숫자둜만 이루어 질 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; + } + static sameStartEndError() { return '상행선 쒅점과 ν•˜ν–‰μ„  쒅점은 같을 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; } diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index f26fff8d7..d78cfaaee 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -36,7 +36,7 @@ export default class LineManagerController { const buttonsArray = Array.from(buttons); const line = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; if (!LineManagerView.confirmDelete()) { - LineManagerView.alertNameError(-7); + LineManagerView.alertNameError(-8); return; } LineManagerModel.delete(line); diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index 563c1509e..a30165070 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -8,6 +8,7 @@ export default class LineManagerModel { this.isEnglish(line), this.isSpecialChar(line), this.isDuplicated(line), + this.isOnlyNumber(line), this.isSame(lineStart, lineEnd), ]; validationCheckFunction.forEach((func, index) => { @@ -47,6 +48,10 @@ export default class LineManagerModel { return lineStart === lineEnd; } + static isOnlyNumber(line) { + return !(/[^0-9]/.test(line)); + } + static add(line, lineStart, lineEnd) { const lines = JSON.parse(localStorage.getItem('Lines')); const stations = JSON.parse(localStorage.getItem('Stations')); From 69a9391a4e1dd95dfe3421279c68d21c2183cca1 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 21:36:17 +0900 Subject: [PATCH 095/101] feat: delete always init local value code --- src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.js b/src/index.js index 19bdaf893..b56f5d6cf 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,6 @@ export default class SubwayManager { if (!(localStorage.getItem('Stations') && localStorage.getItem('Lines'))) { this.setLocalStrageDefault(); } - this.setLocalStrageDefault(); MenuView.menuButtonListView(); MenuController.buttonEventController(); SectionManagerController.buttonEventController(); From bc4e30aaf1a59995ec53884b76f6fc9a0e878535 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 22:58:15 +0900 Subject: [PATCH 096/101] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=84=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/StationManger/StationErrorMsg.js | 8 +-- src/StationManger/StationManagerController.js | 3 +- src/StationManger/StationManagerModel.js | 63 ++++++++++++------- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/StationManger/StationErrorMsg.js b/src/StationManger/StationErrorMsg.js index fe2e1bb66..5bbdfef2a 100644 --- a/src/StationManger/StationErrorMsg.js +++ b/src/StationManger/StationErrorMsg.js @@ -3,8 +3,8 @@ export default class StationErrorMsg { const errorMsg = [ this.lengthError(), this.spaceError(), - this.characterError(), - this.languageError(), + this.koranCharacterError(), + this.notKoreanError(), this.specialCharError(), this.duplicateError(), this.onlyNumberError(), @@ -25,11 +25,11 @@ export default class StationErrorMsg { return 'μ—­ 이름 μ‚¬μ΄μ—λŠ” 곡백이 λ“€μ–΄κ°ˆ 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; } - static characterError() { + static koranCharacterError() { return 'μ™„μ „ν•œ ν•œκΈ€ λ‹¨μ–΄λ‘œ μž…λ ₯ν•΄ μ£Όμ„Έμš”.\nex. ㅏ역 (x) λ‹€μ—­ (o)\n'; } - static languageError() { + static notKoreanError() { return 'μ—­ 이름은 ν•œκΈ€λ‘œλ§Œ μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.\n'; } diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 614d5fef1..778f63cf2 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -17,8 +17,7 @@ export default class StationManagerController { static addButtonClicked() { const station = document.getElementById('station-name-input').value; - const isValid = StationManagerModel.isValidName(station); - console.log(isValid); + const isValid = StationManagerModel.isValidInput(station); if (isValid !== 1) { StationManagerView.alertNameError(isValid); StationManagerView.stationInputView(); diff --git a/src/StationManger/StationManagerModel.js b/src/StationManger/StationManagerModel.js index 7810168d3..1d0d289b3 100644 --- a/src/StationManger/StationManagerModel.js +++ b/src/StationManger/StationManagerModel.js @@ -1,40 +1,40 @@ export default class StationManagerModel { - static add(station) { - const stations = JSON.parse(localStorage.getItem('Stations')); - stations[station] = { "lines": [] }; - localStorage.setItem('Stations', JSON.stringify(stations)); - console.log(JSON.parse(localStorage.getItem('Stations'))); - } + /* + * INPUT CHECK + */ - static isValidName(station) { + static isValidInput(station) { let isValid = 1; const validationCheckFunction = [ this.isValidLength(station), this.isSpace(station), - this.isSingleKoreanAlphabet(station), - this.isEnglish(station), + this.iskoreanCharacterError(station), + this.isAlpha(station), this.isSpecialChar(station), this.isDuplicated(station), this.isOnlyNumber(station), ]; validationCheckFunction.forEach((func, index) => { - if (func) { + if (func && isValid === 1) { isValid = (-1) * index; } }); return isValid; } - static isDuplicated(station) { - const stations = JSON.parse(localStorage.getItem('Stations')); - return Object.keys(stations).indexOf(station) > -1; + static isValidLength(station) { + return station.length < 2; } static isSpace(station) { return station.indexOf(' ') > -1; } - static isEnglish(station) { + static iskoreanCharacterError(station) { + return /[^κ°€-힣a-x0-9]/.test(station); + } + + static isAlpha(station) { return /[a-z]/.test(station); } @@ -42,35 +42,50 @@ export default class StationManagerModel { return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(station); } - static isValidLength(station) { - return station.length < 2; - } - - static isSingleKoreanAlphabet(station) { - return /[^κ°€-힣a-x0-9]/.test(station); + static isDuplicated(station) { + const stations = JSON.parse(localStorage.getItem('Stations')); + return Object.keys(stations).indexOf(station) > -1; } static isOnlyNumber(station) { return !(/[^0-9]/.test(station)); } + /* + * Add + */ + + static add(station) { + const stations = JSON.parse(localStorage.getItem('Stations')); + stations[station] = { "lines": [] }; + localStorage.setItem('Stations', JSON.stringify(stations)); + } + + /* + * DELETE + */ + static delete(station) { const stations = JSON.parse(localStorage.getItem('Stations')); const lines = JSON.parse(localStorage.getItem('Lines')); - const linesOfStation = stations[station].lines; - linesOfStation.forEach((line) => { + const linesIncludingStation = stations[station].lines; + + linesIncludingStation.forEach((line) => { lines[line].stations.splice(lines[line].stations.indexOf(station), 1); }); delete stations[station]; + localStorage.setItem('Lines', JSON.stringify(lines)); localStorage.setItem('Stations', JSON.stringify(stations)); } static checkAfterDelete(station) { + const stations = JSON.parse(localStorage.getItem('Stations')); const lines = JSON.parse(localStorage.getItem('Lines')); - const linesOfStation = JSON.parse(localStorage.getItem('Stations'))[station].lines; + const linesIncludingStation = stations[station].lines; + let isValid = 1; - linesOfStation.forEach((line) => { + linesIncludingStation.forEach((line) => { if (lines[line].stations.length <= 2) { isValid = -7; } From 968bac60edb7fb99339364a8ac7e64fd0ac5780e Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 23:05:55 +0900 Subject: [PATCH 097/101] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=84=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LineManger/LineErrorMsg.js | 8 ++-- src/LineManger/LineManagerController.js | 4 +- src/LineManger/LineManagerModel.js | 51 ++++++++++++++----------- src/LineManger/LineManagerView.js | 2 +- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/LineManger/LineErrorMsg.js b/src/LineManger/LineErrorMsg.js index 7b06c9455..a90657b35 100644 --- a/src/LineManger/LineErrorMsg.js +++ b/src/LineManger/LineErrorMsg.js @@ -3,8 +3,8 @@ export default class LineErrorMsg { const errorMsg = [ this.lengthError(), this.spaceError(), - this.characterError(), - this.languageError(), + this.koranCharacterError(), + this.notKoreanError(), this.specialCharError(), this.duplicateError(), this.onlyNumberError(), @@ -26,11 +26,11 @@ export default class LineErrorMsg { return 'λ…Έμ„  이름 μ‚¬μ΄μ—λŠ” 곡백이 λ“€μ–΄κ°ˆ 수 μ—†μŠ΅λ‹ˆλ‹€.\n'; } - static characterError() { + static koranCharacterError() { return 'μ™„μ „ν•œ ν•œκΈ€ λ‹¨μ–΄λ‘œ μž…λ ₯ν•΄ μ£Όμ„Έμš”.\nex. ㅏ역 (x) λ‹€μ—­ (o)\n'; } - static languageError() { + static notKoreanError() { return 'λ…Έμ„  이름은 ν•œκΈ€λ‘œλ§Œ μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.\n'; } diff --git a/src/LineManger/LineManagerController.js b/src/LineManger/LineManagerController.js index d78cfaaee..9fa540628 100644 --- a/src/LineManger/LineManagerController.js +++ b/src/LineManger/LineManagerController.js @@ -22,7 +22,7 @@ export default class LineManagerController { const lineEnd = document.getElementById('line-end-station-selector').value; const isValid = LineManagerModel.isValidInput(line, lineStart, lineEnd); if (isValid !== 1) { - LineManagerView.alertNameError(isValid); + LineManagerView.alertError(isValid); LineManagerView.lineInputView(); return; } @@ -36,7 +36,7 @@ export default class LineManagerController { const buttonsArray = Array.from(buttons); const line = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; if (!LineManagerView.confirmDelete()) { - LineManagerView.alertNameError(-8); + LineManagerView.alertError(-8); return; } LineManagerModel.delete(line); diff --git a/src/LineManger/LineManagerModel.js b/src/LineManger/LineManagerModel.js index a30165070..063eabf3f 100644 --- a/src/LineManger/LineManagerModel.js +++ b/src/LineManger/LineManagerModel.js @@ -1,11 +1,14 @@ export default class LineManagerModel { + /* + * INPUT CHECK + */ static isValidInput(line, lineStart, lineEnd) { let isValid = 1; const validationCheckFunction = [ this.isValidLength(line), this.isSpace(line), - this.isSingleKoreanAlphabet(line), - this.isEnglish(line), + this.iskoreanCharacterError(line), + this.isAlpha(line), this.isSpecialChar(line), this.isDuplicated(line), this.isOnlyNumber(line), @@ -23,16 +26,15 @@ export default class LineManagerModel { return line.length < 2; } - static isDuplicated(line) { - const lines = Object.keys(JSON.parse(localStorage.getItem('Lines'))); - return lines.indexOf(line) > -1; - } - static isSpace(line) { return line.indexOf(' ') > -1; } - static isEnglish(line) { + static iskoreanCharacterError(line) { + return /[^κ°€-힣a-z0-9]/.test(line); + } + + static isAlpha(line) { return /[a-z]/.test(line); } @@ -40,18 +42,22 @@ export default class LineManagerModel { return /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(line); } - static isSingleKoreanAlphabet(line) { - return /[^κ°€-힣a-z0-9]/.test(line); - } - - static isSame(lineStart, lineEnd) { - return lineStart === lineEnd; + static isDuplicated(line) { + const lines = Object.keys(JSON.parse(localStorage.getItem('Lines'))); + return lines.indexOf(line) > -1; } static isOnlyNumber(line) { return !(/[^0-9]/.test(line)); } + static isSame(lineStart, lineEnd) { + return lineStart === lineEnd; + } + + /* + * Add + */ static add(line, lineStart, lineEnd) { const lines = JSON.parse(localStorage.getItem('Lines')); const stations = JSON.parse(localStorage.getItem('Stations')); @@ -63,24 +69,25 @@ export default class LineManagerModel { if (stations[lineEnd].lines.indexOf(line) < 0) { stations[lineEnd].lines.push(line); } + localStorage.setItem('Lines', JSON.stringify(lines)); localStorage.setItem('Stations', JSON.stringify(stations)); } - static isInLines(line) { - const lines = Object.keys(JSON.parse(localStorage.getItem('Lines'))); - return lines.indexOf(line) > -1; - } - + /* + * DELETE + */ static delete(line) { const lines = JSON.parse(localStorage.getItem('Lines')); const stations = JSON.parse(localStorage.getItem('Stations')); - const stationsOfLines = lines[line].stations; - stationsOfLines.forEach((station) => { + const stationsIncludedByLine = lines[line].stations; + + stationsIncludedByLine.forEach((station) => { stations[station].lines.splice(stations[station].lines.indexOf(line), 1); }); delete lines[line]; + localStorage.setItem('Stations', JSON.stringify(stations)); localStorage.setItem('Lines', JSON.stringify(lines)); } -} \ No newline at end of file +} diff --git a/src/LineManger/LineManagerView.js b/src/LineManger/LineManagerView.js index c4e5bc07a..53e5a5a02 100644 --- a/src/LineManger/LineManagerView.js +++ b/src/LineManger/LineManagerView.js @@ -50,7 +50,7 @@ export default class LineManagerView { `; } - static alertNameError(errorNum) { + static alertError(errorNum) { alert(LineErrorMsg.error(errorNum)); } From c84bd05d2cdd54dc6cdc63ac4b8e633856d722ba Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 23:07:11 +0900 Subject: [PATCH 098/101] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=84=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/StationManger/StationManagerController.js | 7 ++++--- src/StationManger/StationManagerView.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 778f63cf2..5b861c6dd 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -8,7 +8,8 @@ export default class StationManagerController { const eventClassName = event.target.className; if (eventId === 'station-add-button') { this.addButtonClicked(); - } else if (eventClassName === 'station-delete-button') { + } + if (eventClassName === 'station-delete-button') { const button = event.path[0]; this.deleteButtonClicked(button); } @@ -19,7 +20,7 @@ export default class StationManagerController { const station = document.getElementById('station-name-input').value; const isValid = StationManagerModel.isValidInput(station); if (isValid !== 1) { - StationManagerView.alertNameError(isValid); + StationManagerView.alertError(isValid); StationManagerView.stationInputView(); return; } @@ -38,7 +39,7 @@ export default class StationManagerController { return; } if (!StationManagerView.confirmDelete()) { - StationManagerView.alertNameError(-8); + StationManagerView.alertError(-8); return; } StationManagerModel.delete(station); diff --git a/src/StationManger/StationManagerView.js b/src/StationManger/StationManagerView.js index 0d248de6b..e9d40c809 100644 --- a/src/StationManger/StationManagerView.js +++ b/src/StationManger/StationManagerView.js @@ -39,7 +39,7 @@ export default class StationManagerView { `; } - static alertNameError(errorNum) { + static alertError(errorNum) { alert(StationErrorMsg.error(errorNum)); } From 9593031d4e242c2f8ae79409a1c71b9e131415ad Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 23:12:42 +0900 Subject: [PATCH 099/101] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=84=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SectionManager/SectionManagerModel.js | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/SectionManager/SectionManagerModel.js b/src/SectionManager/SectionManagerModel.js index d4fe369f7..25d4d6b0b 100644 --- a/src/SectionManager/SectionManagerModel.js +++ b/src/SectionManager/SectionManagerModel.js @@ -3,7 +3,7 @@ export default class SectionManagerModel { if (!SectionManagerModel.isValidNumber(line, index)) { return 0; } - if (SectionManagerModel.isInLines(line, station)) { + if (SectionManagerModel.isDuplicated(line, station)) { return -1; } return 1; @@ -22,21 +22,24 @@ export default class SectionManagerModel { return !/[^0-9]/.test(`${number}`); } - static isInLines(line, station) { - const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; - return stations.indexOf(station) > -1; + static isDuplicated(line, station) { + const lines = JSON.parse(localStorage.getItem('Lines')); + const stationIncludedByLine = lines[line].stations; + return stationIncludedByLine.indexOf(station) > -1; } static add(line, station, index) { const lines = JSON.parse(localStorage.getItem('Lines')); - const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; - const stationJSON = JSON.parse(localStorage.getItem('Stations')); - if (stationJSON[station].lines.indexOf(line) < 0) { - stationJSON[station].lines.push(line); + const stationIncludedByLine = lines[line].stations; + const stations = JSON.parse(localStorage.getItem('Stations')); + + if (stations[station].lines.indexOf(line) < 0) { + stations[station].lines.push(line); } - stations.splice(index, 0, station); - lines[line].stations = stations; - localStorage.setItem('Stations', JSON.stringify(stationJSON)); + stationIncludedByLine.splice(index, 0, station); + lines[line].stations = stationIncludedByLine; + + localStorage.setItem('Stations', JSON.stringify(stations)); localStorage.setItem('Lines', JSON.stringify(lines)); } @@ -46,9 +49,9 @@ export default class SectionManagerModel { static delete(line, station) { const lines = JSON.parse(localStorage.getItem('Lines')); - const stations = JSON.parse(localStorage.getItem('Lines'))[line].stations; - stations.splice(stations.indexOf(station), 1); - lines[line].stations = stations; + const stationIncludedByLine = JSON.parse(localStorage.getItem('Lines'))[line].stations; + stationIncludedByLine.splice(stationIncludedByLine.indexOf(station), 1); + lines[line].stations = stationIncludedByLine; localStorage.setItem('Lines', JSON.stringify(lines)); } } From de514f01e46ae13f82ec6e5b45b8337be8986bb9 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 23:12:49 +0900 Subject: [PATCH 100/101] =?UTF-8?q?refactor:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=84=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/StationManger/StationManagerController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StationManger/StationManagerController.js b/src/StationManger/StationManagerController.js index 5b861c6dd..e58a70ca9 100644 --- a/src/StationManger/StationManagerController.js +++ b/src/StationManger/StationManagerController.js @@ -35,7 +35,7 @@ export default class StationManagerController { const station = buttons[buttonsArray.indexOf(button)].dataset.deleteTarget; const isValid = StationManagerModel.checkAfterDelete(station); if (isValid !== 1) { - StationManagerView.alertNameError(isValid); + StationManagerView.alertError(isValid); return; } if (!StationManagerView.confirmDelete()) { From 0673d1d3cbe33a33b1ab1435286e987ccacb55e6 Mon Sep 17 00:00:00 2001 From: sunhpark42 Date: Tue, 15 Dec 2020 23:25:45 +0900 Subject: [PATCH 101/101] =?UTF-8?q?feat:=20=EB=A1=9C=EC=BB=AC=20=EC=8A=A4?= =?UTF-8?q?=ED=86=A0=EB=A6=AC=EC=A7=80=EC=97=90=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EB=90=9C=20=EA=B0=92=EC=9D=B4=20{}=20(=EB=B9=88=EB=B0=B0?= =?UTF-8?q?=EC=97=B4)=EC=9D=BC=20=EB=95=8C=20Default=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b56f5d6cf..d3514520a 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ import SectionManagerController from './SectionManager/SectionManagerController. export default class SubwayManager { constructor() { - if (!(localStorage.getItem('Stations') && localStorage.getItem('Lines'))) { + if (this.checkLocalStorage()) { this.setLocalStrageDefault(); } MenuView.menuButtonListView(); @@ -16,6 +16,12 @@ export default class SubwayManager { StationManagerController.buttonEventController(); } + checkLocalStorage() { + const stations = localStorage.getItem('Stations'); + const lines = localStorage.getItem('Lines'); + return !(stations && lines) || (stations === '{}') || (lines === '{}'); + } + setLocalStrageDefault() { const stationDefault = { "인천": { "lines": ["1ν˜Έμ„ ", "3ν˜Έμ„ "] },