From 170b317da5757253053cb415955bdbbeaaf0b90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A3=BC=ED=9D=AC?= <50205928+maywngml@users.noreply.github.com> Date: Wed, 9 Dec 2020 17:20:35 +0900 Subject: [PATCH 01/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=ED=95=A0=20=EA=B8=B0=EB=8A=A5=20=EB=AA=A9=EB=A1=9D=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 136 +++++++++++------------------------------------------- 1 file changed, 27 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index e97a1d649..73b1517b0 100644 --- a/README.md +++ b/README.md @@ -1,114 +1,32 @@ # πŸš‡ μ§€ν•˜μ²  노선도 λ―Έμ…˜ -## πŸš€ κΈ°λŠ₯ μš”κ΅¬μ‚¬ν•­ +## πŸš€ κ΅¬ν˜„ κΈ°λŠ₯ λͺ©λ‘ ### μ§€ν•˜μ²  μ—­ κ΄€λ ¨ κΈ°λŠ₯ -- μ§€ν•˜μ²  역을 λ“±λ‘ν•˜κ³  μ‚­μ œν•  수 μžˆλ‹€. (단, 노선에 λ“±λ‘λœ 역은 μ‚­μ œν•  수 μ—†λ‹€) -- μ€‘λ³΅λœ μ§€ν•˜μ²  μ—­ 이름이 등둝될 수 μ—†λ‹€. -- μ§€ν•˜μ²  역은 2κΈ€μž 이상이어야 ν•œλ‹€. -- μ§€ν•˜μ²  μ—­μ˜ λͺ©λ‘μ„ μ‘°νšŒν•  수 μžˆλ‹€. - +- μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ΄λ¦„μœΌλ‘œ μ§€ν•˜μ²  역을 λ“±λ‘ν•œλ‹€. + - μž…λ ₯κ°’μ˜ 곡백을 μ œκ±°ν•΄μ•Ό ν•œλ‹€. + - μ—­ 이름이 2κΈ€μž 이상인지 확인해야 ν•œλ‹€. + - μ—­ μ΄λ¦„μ˜ 쀑볡여뢀λ₯Ό 확인해야 ν•œλ‹€. +- λ“±λ‘λœ μ§€ν•˜μ²  역을 μ‚­μ œν•œλ‹€. + - 노선에 λ“±λ‘λ˜μ–΄ μžˆλŠ”μ§€ 확인해야 ν•œλ‹€. +- μ§€ν•˜μ²  μ—­μ˜ λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. ### μ§€ν•˜μ²  λ…Έμ„  κ΄€λ ¨ κΈ°λŠ₯ -- μ§€ν•˜μ²  노선을 λ“±λ‘ν•˜κ³  μ‚­μ œν•  수 μžˆλ‹€. -- μ€‘λ³΅λœ μ§€ν•˜μ²  λ…Έμ„  이름이 등둝될 수 μ—†λ‹€. -- λ…Έμ„  등둝 μ‹œ 상행 쒅점역과 ν•˜ν–‰ 쒅점역을 μž…λ ₯λ°›λŠ”λ‹€. -- μ§€ν•˜μ²  λ…Έμ„ μ˜ λͺ©λ‘μ„ μ‘°νšŒν•  수 μžˆλ‹€. - -### μ§€ν•˜μ²  ꡬ간 μΆ”κ°€ κΈ°λŠ₯ -- μ§€ν•˜μ²  노선에 ꡬ간을 μΆ”κ°€ν•˜λŠ” κΈ°λŠ₯은 노선에 역을 μΆ”κ°€ν•˜λŠ” κΈ°λŠ₯이라고도 ν•  수 μžˆλ‹€. - - μ—­κ³Ό 역사이λ₯Ό ꡬ간이라 ν•˜κ³  이 κ΅¬κ°„λ“€μ˜ λͺ¨μŒμ΄ 노선이닀. -- ν•˜λ‚˜μ˜ 역은 μ—¬λŸ¬κ°œμ˜ 노선에 좔가될 수 μžˆλ‹€. -- μ—­κ³Ό μ—­ 사이에 μƒˆλ‘œμš΄ 역이 μΆ”κ°€ 될 수 μžˆλ‹€. -- λ…Έμ„ μ—μ„œ κ°ˆλž˜κΈΈμ€ 생길 수 μ—†λ‹€. - - - -### μ§€ν•˜μ²  ꡬ간 μ‚­μ œ κΈ°λŠ₯ -- 노선에 λ“±λ‘λœ 역을 μ œκ±°ν•  수 μžˆλ‹€. -- 쒅점을 μ œκ±°ν•  경우 λ‹€μŒ 역이 쒅점이 λœλ‹€. -- 노선에 ν¬ν•¨λœ 역이 λ‘κ°œ μ΄ν•˜μΌ λ•ŒλŠ” 역을 μ œκ±°ν•  수 μ—†λ‹€. - - - -### μ§€ν•˜μ²  노선에 λ“±λ‘λœ μ—­ 쑰회 κΈ°λŠ₯ -- λ…Έμ„ μ˜ 상행 쒅점뢀터 ν•˜ν–‰ μ’…μ κΉŒμ§€ μ—°κ²°λœ μˆœμ„œλŒ€λ‘œ μ—­ λͺ©λ‘μ„ μ‘°νšŒν•  수 μžˆλ‹€. - -
- -## πŸ’» ν”„λ‘œκ·Έλž¨ μ‹€ν–‰ κ²°κ³Ό - -### 역관리 - - -### 노선관리 - - -### ꡬ간관리 - - -### 노선도 좜λ ₯ - - - -## βœ… ν”„λ‘œκ·Έλž˜λ° μš”κ΅¬μ‚¬ν•­ - -### 메뉴 λ²„νŠΌ -- μ—­ 관리 button νƒœκ·ΈλŠ” `#station-manager-button` id값을 κ°€μ§„λ‹€. -- λ…Έμ„  관리 button νƒœκ·ΈλŠ” `#line-manager-button` id값을 κ°€μ§„λ‹€. -- ꡬ간 관리 button νƒœκ·ΈλŠ” `#section-manager-button` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  노선도 좜λ ₯ 관리 button νƒœκ·ΈλŠ” `#map-print-manager-button` id값을 κ°€μ§„λ‹€. - -### μ§€ν•˜μ²  μ—­ κ΄€λ ¨ κΈ°λŠ₯ -- μ§€ν•˜μ²  역을 μž…λ ₯ν•˜λŠ” input νƒœκ·ΈλŠ” `#station-name-input` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  역을 μΆ”κ°€ν•˜λŠ” button νƒœκ·ΈλŠ” `#station-add-button` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  역을 μ‚­μ œν•˜λŠ” button νƒœκ·ΈλŠ” `.station-delete-button` class값을 κ°€μ§„λ‹€. - -### μ§€ν•˜μ²  λ…Έμ„  κ΄€λ ¨ κΈ°λŠ₯ -- μ§€ν•˜μ²  λ…Έμ„ μ˜ 이름을 μž…λ ₯ν•˜λŠ” input νƒœκ·ΈλŠ” `#line-name-input` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  λ…Έμ„ μ˜ 상행 쒅점을 μ„ νƒν•˜λŠ” select νƒœκ·ΈλŠ” `#line-start-station-selector` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  λ…Έμ„ μ˜ ν•˜ν–‰ 쒅점을 μ„ νƒν•˜λŠ” select νƒœκ·ΈλŠ” `#line-end-station-selector` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  노선을 μΆ”κ°€ν•˜λŠ” button νƒœκ·ΈλŠ” `#line-add-button` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  노선을 μ‚­μ œν•˜λŠ” button νƒœκ·ΈλŠ” `.line-delete-button` class값을 κ°€μ§„λ‹€. - -### μ§€ν•˜μ²  ꡬ간 μΆ”κ°€ κΈ°λŠ₯ -- μ§€ν•˜μ²  노선을 μ„ νƒν•˜λŠ” button νƒœκ·ΈλŠ” `.section-line-menu-button` class값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  ꡬ간을 μ„€μ •ν•  μ—­ select νƒœκ·ΈλŠ” `#section-station-selector` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  κ΅¬κ°„μ˜ μˆœμ„œλ₯Ό μž…λ ₯ν•˜λŠ” input νƒœκ·ΈλŠ” `#section-order-input` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  ꡬ간을 λ“±λ‘ν•˜λŠ” button νƒœκ·ΈλŠ” `#section-add-button` id값을 κ°€μ§„λ‹€. -- μ§€ν•˜μ²  ꡬ간을 μ œκ±°ν•˜λŠ” button νƒœκ·ΈλŠ” `.section-delete-button` class값을 κ°€μ§„λ‹€. - -### μ§€ν•˜μ²  노선도 좜λ ₯ κΈ°λŠ₯ -- μ§€ν•˜μ²  노선도 좜λ ₯ λ²„νŠΌμ„ λˆ„λ₯΄λ©΄ `
` νƒœκ·Έλ₯Ό λ§Œλ“€κ³  ν•΄λ‹Ή νƒœκ·Έ 내뢀에 노선도λ₯Ό 좜λ ₯ν•œλ‹€. - -### κΈ°μ‘΄ μš”κ΅¬μ‚¬ν•­ - -- μ‚¬μš©μžκ°€ 잘λͺ»λœ μž…λ ₯ 값을 μž‘μ„±ν•œ 경우 `alert`을 μ΄μš©ν•΄ λ©”μ‹œμ§€λ₯Ό 보여주고, μž¬μž…λ ₯ν•  수 있게 ν•œλ‹€. -- μ™ΈλΆ€ 라이브러리(jQuery, Lodash λ“±)λ₯Ό μ‚¬μš©ν•˜μ§€ μ•Šκ³ , 순수 Vanilla JS둜만 κ΅¬ν˜„ν•œλ‹€. -- **μžλ°”μŠ€ν¬λ¦½νŠΈ μ½”λ“œ μ»¨λ²€μ…˜μ„ μ§€ν‚€λ©΄μ„œ ν”„λ‘œκ·Έλž˜λ°** ν•œλ‹€ - - [https://google.github.io/styleguide/jsguide.html](https://google.github.io/styleguide/jsguide.html) - - [https://ui.toast.com/fe-guide/ko_CODING-CONVENSION/](https://ui.toast.com/fe-guide/ko_CODING-CONVENTION) -- **indent(인덴트, λ“€μ—¬μ“°κΈ°) depthλ₯Ό 3이 λ„˜μ§€ μ•Šλ„λ‘ κ΅¬ν˜„ν•œλ‹€. 2κΉŒμ§€λ§Œ ν—ˆμš©**ν•œλ‹€. - - 예λ₯Ό λ“€μ–΄ whileλ¬Έ μ•ˆμ— if문이 있으면 λ“€μ—¬μ“°κΈ°λŠ” 2이닀. - - 힌트: indent(인덴트, λ“€μ—¬μ“°κΈ°) depthλ₯Ό μ€„μ΄λŠ” 쒋은 방법은 ν•¨μˆ˜(λ˜λŠ” λ©”μ†Œλ“œ)λ₯Ό λΆ„λ¦¬ν•˜λ©΄ λœλ‹€. -- **ν•¨μˆ˜(λ˜λŠ” λ©”μ†Œλ“œ)의 길이가 15라인을 λ„˜μ–΄κ°€μ§€ μ•Šλ„λ‘ κ΅¬ν˜„ν•œλ‹€.** - - ν•¨μˆ˜(λ˜λŠ” λ©”μ†Œλ“œ)κ°€ ν•œ κ°€μ§€ 일만 잘 ν•˜λ„λ‘ κ΅¬ν˜„ν•œλ‹€. -- λ³€μˆ˜ μ„ μ–Έμ‹œ `var` λ₯Ό μ‚¬μš©ν•˜μ§€ μ•ŠλŠ”λ‹€. `const` 와 `let` 을 μ‚¬μš©ν•œλ‹€. - - [const](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/const) - - [let](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/let) -- `import` 문을 μ΄μš©ν•΄ 슀크립트λ₯Ό λͺ¨λ“ˆν™”ν•˜κ³  뢈러올 수 있게 λ§Œλ“ λ‹€. - - [https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/import](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/import) -- `template literal`을 μ΄μš©ν•΄ 데이터와 html string을 가독성 μ’‹κ²Œ ν‘œν˜„ν•œλ‹€. - - [https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals) - -### μΆ”κ°€λœ μš”κ΅¬μ‚¬ν•­ -- [data](https://developer.mozilla.org/ko/docs/Learn/HTML/Howto/%EB%8D%B0%EC%9D%B4%ED%84%B0_%EC%86%8D%EC%84%B1_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0)속성을 ν™œμš©ν•˜μ—¬ html νƒœκ·Έμ— μ—­, λ…Έμ„ , κ΅¬κ°„μ˜ μœ μΌν•œ 데이터 값듀을 κ΄€λ¦¬ν•œλ‹€. -- [localStorage](https://developer.mozilla.org/ko/docs/Web/API/Window/localStorage)λ₯Ό μ΄μš©ν•˜μ—¬, μƒˆλ‘œκ³ μΉ¨ν•˜λ”λΌλ„ κ°€μž₯ μ΅œκ·Όμ— μž‘μ—…ν•œ 정보듀을 뢈러올 수 μžˆλ„λ‘ ν•œλ‹€. - -
- -## πŸ“ λ―Έμ…˜ μ €μž₯μ†Œ 및 μ§„ν–‰ μš”κ΅¬μ‚¬ν•­ - -- λ―Έμ…˜μ€ [https://github.com/woowacourse/javascript-subway-map-precours](https://github.com/woowacourse/javascript-subway-map-precourse) μ €μž₯μ†Œλ₯Ό fork/cloneν•΄ μ‹œμž‘ν•œλ‹€. -- **κΈ°λŠ₯을 κ΅¬ν˜„ν•˜κΈ° 전에 javascript-subway-precourse/docs/README.md νŒŒμΌμ— κ΅¬ν˜„ν•  κΈ°λŠ₯ λͺ©λ‘**을 정리해 μΆ”κ°€ν•œλ‹€. -- **git의 commit λ‹¨μœ„λŠ” μ•ž λ‹¨κ³„μ—μ„œ README.md νŒŒμΌμ— μ •λ¦¬ν•œ κΈ°λŠ₯ λͺ©λ‘ λ‹¨μœ„λ‘œ μΆ”κ°€**ν•œλ‹€. -- [ν”„λ¦¬μ½”μŠ€ 과제 제좜](https://github.com/woowacourse/woowacourse-docs/tree/master/precourse) λ¬Έμ„œ 절차λ₯Ό 따라 λ―Έμ…˜μ„ μ œμΆœν•œλ‹€. +- μ§€ν•˜μ²  노선을 λ“±λ‘ν•œλ‹€. + - λ…Έμ„ μ˜ 쀑볡 μ—¬λΆ€λ₯Ό 확인해야 ν•œλ‹€. +- μ§€ν•˜μ²  노선을 μ‚­μ œν•œλ‹€. +- μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. + - λ…Έμ„  이름, 상행 쒅점역, ν•˜ν–‰ 쒅점역을 μ‘°νšŒν•΄μ•Ό ν•œλ‹€. +### μ§€ν•˜μ²  ꡬ간 κ΄€λ ¨ κΈ°λŠ₯ +- 기쑴의 μ§€ν•˜μ²  λ…Έμ„  사이에 역을 μƒˆλ‘œ μΆ”κ°€ν•œλ‹€. + - μΆ”κ°€ν•˜λ €λŠ” 노선에 이미 λ“±λ‘λœ 역인지 확인해야 ν•œλ‹€. + - μž„μ˜λ‘œ μˆœμ„œλ₯Ό μ •ν•  수 μžˆλ‹€. + - μˆœμ„œ μž…λ ₯값이 '0 ~ 노선에 λ“±λ‘λœ μ—­μ˜ 수' 사이인지 확인해야 ν•œλ‹€. +- 노선에 λ“±λ‘λœ 역을 μ œκ±°ν•œλ‹€. + - λ…Έμ„ λ‚΄μ˜ μ—­μ˜ κ°œμˆ˜κ°€ 2개λ₯Ό μ΄ˆκ³Όν•˜λŠ”μ§€ 확인해야 ν•œλ‹€. + - 상행쒅점역을 μ œκ±°ν–ˆμ„ 경우 λ‹€μŒμ—­μ΄ 상행쒅점역이 λ˜λ„λ‘ ν•œλ‹€. + - ν•˜ν–‰μ’…μ μ—­μ„ μ œκ±°ν–ˆμ„ 경우 이전역이 ν•˜ν–‰μ’…μ μ—­μ΄ λ˜λ„λ‘ ν•œλ‹€. +### μ§€ν•˜μ²  전체 λ…Έμ„  쑰회 κΈ°λŠ₯ +- λͺ¨λ“  μ§€ν•˜μ²  λ…Έμ„ μ˜ μ—­ λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. +### 곡톡 κΈ°λŠ₯ +- λ°μ΄ν„°μ˜ λ“±λ‘μ΄λ‚˜ μ‚­μ œκ°€ λΆˆκ°€ν•  경우 alert창을 λ„μš΄λ‹€. +- κΈ°μ‘΄ 데이터λ₯Ό μ‚­μ œν•  경우 νŒμ—…μ°½μ„ λ„μ›Œμ„œ ν•œλ²ˆ 더 확인할 수 μžˆλ„λ‘ ν•œλ‹€. From 08fa7daa221b4b41458d1539dc8a6639fde5bb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A3=BC=ED=9D=AC?= <50205928+maywngml@users.noreply.github.com> Date: Wed, 9 Dec 2020 18:54:11 +0900 Subject: [PATCH 02/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EB=AA=A9=EB=A1=9D=EC=97=90=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=EA=B0=92=20=EC=B2=98=EB=A6=AC=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73b1517b0..e3b84d1d3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ ### μ§€ν•˜μ²  μ—­ κ΄€λ ¨ κΈ°λŠ₯ - μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ΄λ¦„μœΌλ‘œ μ§€ν•˜μ²  역을 λ“±λ‘ν•œλ‹€. - - μž…λ ₯κ°’μ˜ 곡백을 μ œκ±°ν•΄μ•Ό ν•œλ‹€. - μ—­ 이름이 2κΈ€μž 이상인지 확인해야 ν•œλ‹€. - μ—­ μ΄λ¦„μ˜ 쀑볡여뢀λ₯Ό 확인해야 ν•œλ‹€. - λ“±λ‘λœ μ§€ν•˜μ²  역을 μ‚­μ œν•œλ‹€. @@ -30,3 +29,5 @@ ### 곡톡 κΈ°λŠ₯ - λ°μ΄ν„°μ˜ λ“±λ‘μ΄λ‚˜ μ‚­μ œκ°€ λΆˆκ°€ν•  경우 alert창을 λ„μš΄λ‹€. - κΈ°μ‘΄ 데이터λ₯Ό μ‚­μ œν•  경우 νŒμ—…μ°½μ„ λ„μ›Œμ„œ ν•œλ²ˆ 더 확인할 수 μžˆλ„λ‘ ν•œλ‹€. +- μž…λ ₯값이 λΉˆκ°’μΈμ§€ 확인해야 ν•œλ‹€. +- μž…λ ₯κ°’μ˜ 곡백을 μ œκ±°ν•΄μ•Ό ν•œλ‹€. From dd91f4335f6f20eb28119750422cb5eec42a237d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A3=BC=ED=9D=AC?= <50205928+maywngml@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:57:59 +0900 Subject: [PATCH 03/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EB=85=B8=EC=84=A0?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e3b84d1d3..c3fb458f4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ - μ§€ν•˜μ²  노선을 μ‚­μ œν•œλ‹€. - μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. - λ…Έμ„  이름, 상행 쒅점역, ν•˜ν–‰ 쒅점역을 μ‘°νšŒν•΄μ•Ό ν•œλ‹€. + - λ…Έμ„  이름은 μ˜€λ¦„μ°¨μˆœμœΌλ‘œ μ •λ ¬ν•œλ‹€. ### μ§€ν•˜μ²  ꡬ간 κ΄€λ ¨ κΈ°λŠ₯ - 기쑴의 μ§€ν•˜μ²  λ…Έμ„  사이에 역을 μƒˆλ‘œ μΆ”κ°€ν•œλ‹€. - μΆ”κ°€ν•˜λ €λŠ” 노선에 이미 λ“±λ‘λœ 역인지 확인해야 ν•œλ‹€. From 799a5e5aad89d94f2b81d45ff3af9fdcffb5d0c8 Mon Sep 17 00:00:00 2001 From: maywngml Date: Fri, 11 Dec 2020 18:38:34 +0900 Subject: [PATCH 04/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EC=97=AD=20=EB=93=B1=EB=A1=9D=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 18 + .gitignore | 2 + index.html | 8 + package-lock.json | 1543 ++++++++++++++++++++++++++++++++++++++++ package.json | 26 + src/common.js | 62 ++ src/index.js | 15 + src/station-manager.js | 46 ++ src/style.css | 8 + 9 files changed, 1728 insertions(+) create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/common.js create mode 100644 src/station-manager.js create mode 100644 src/style.css diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..d92b4d5f3 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,18 @@ +module.exports = { + env: { + browser: true, + es2021: true + }, + extends: [ + 'standard' + ], + parserOptions: { + ecmaVersion: 12, + sourceType: 'module' + }, + rules: { + indent: [ + 'tab', + 4] + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..315ab99fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vscode/ +/node_modules/ \ No newline at end of file diff --git a/index.html b/index.html index fc99deac2..e8c3a3199 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,19 @@ + μ§€ν•˜μ²  노선도 관리

πŸš‡ μ§€ν•˜μ²  노선도 관리

+
+ + + + +
+
diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..e3054147f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1543 @@ +{ + "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 + }, + "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-standard": { + "version": "16.0.2", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz", + "integrity": "sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw==", + "dev": true + }, + "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-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + } + }, + "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-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-plugin-promise": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", + "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", + "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.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..c32e21475 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "javascript-subway-map-precourse", + "version": "1.0.0", + "description": "- μ§€ν•˜μ²  역을 λ“±λ‘ν•˜κ³  μ‚­μ œν•  수 μžˆλ‹€. (단, 노선에 λ“±λ‘λœ 역은 μ‚­μ œν•  수 μ—†λ‹€)\r - μ€‘λ³΅λœ μ§€ν•˜μ²  μ—­ 이름이 등둝될 수 μ—†λ‹€.\r - μ§€ν•˜μ²  역은 2κΈ€μž 이상이어야 ν•œλ‹€.\r - μ§€ν•˜μ²  μ—­μ˜ λͺ©λ‘μ„ μ‘°νšŒν•  수 μžˆλ‹€.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/maywngml/javascript-subway-map-precourse.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/maywngml/javascript-subway-map-precourse/issues" + }, + "homepage": "https://github.com/maywngml/javascript-subway-map-precourse#readme", + "devDependencies": { + "eslint": "7.15.0", + "eslint-config-standard": "16.0.2", + "eslint-plugin-import": "2.22.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "4.2.1" + } +} diff --git a/src/common.js b/src/common.js new file mode 100644 index 000000000..a0b1ec545 --- /dev/null +++ b/src/common.js @@ -0,0 +1,62 @@ +export const managerPart = document.getElementById("manager-part"); + +export function addClickEventListener(target, listener) { + target.addEventListener("click", listener); +} + +export function addElement(type, content, attribute, attributeName) { + const element = document.createElement(type); + element.append(content); + element.setAttribute(attribute, attributeName); + managerPart.append(element); +} + +export function addInputElement(name, information) { + const element = document.createElement("input"); + element.setAttribute("type", "text"); + element.setAttribute("id", name); + element.setAttribute("placeholder", information); + managerPart.append(element); +} + +export function pageInit() { + managerPart.innerHTML = ""; +} + +export function removeWhiteSpaceValue(value) { + return value.replace(/^\s+|\s+$/gm, ''); +} + +export function isEmpty(value) { + let result = true; + if(value === "" || value === null || value === undefined || (value !== null + && typeof value === "object" && !Object.keys(value).length)) { + result = false; + } + return result; +} + +export function itemDuplicateCheck(itemList, value) { + let isDuplicate = false; + if(itemList.includes(value)) { + alert(`${value}은 이미 λ“±λ‘λœ μ΄λ¦„μž…λ‹ˆλ‹€`); + isDuplicate = true; + } + return isDuplicate; +} + +export function getItemList(key) { + return JSON.parse(localStorage.getItem(key)); +} + +export function addItem(key, value) { + let itemList = getItemList(key); + // μˆ˜μ • - 더 효율적으둜 μˆ˜μ •ν•˜κΈ° + if(itemList === null){ + itemList = []; + } + if(!itemDuplicateCheck(itemList, value)){ + itemList.push(value); + localStorage.setItem(key, JSON.stringify(itemList)); + } +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index e69de29bb..023a59754 100644 --- a/src/index.js +++ b/src/index.js @@ -0,0 +1,15 @@ +import {addClickEventListener} from './common.js' +import StationManager from './station-manager.js'; +// import LineManager from './line-manager.js'; +// import SectionManager from './section-manager.js'; +// import MapPringManager from './map-print-manager.js'; + +export default function stationPageInit() { + const stationManagerButton = document.getElementById('station-manager-button'); + const lineManagerButton = document.getElementById('line-manager-button'); + const sectionManagerButton = document.getElementById('section-manager-button'); + const mapPrintManagerButton = document.getElementById('map-print-manager-button'); + addClickEventListener(stationManagerButton, () => {new StationManager()}); +} + +new stationPageInit(); diff --git a/src/station-manager.js b/src/station-manager.js new file mode 100644 index 000000000..b5915983b --- /dev/null +++ b/src/station-manager.js @@ -0,0 +1,46 @@ +import { + addElement, + addInputElement, + addClickEventListener, + pageInit, + managerPart, + isEmpty, + addItem, + removeWhiteSpaceValue +} from "./common.js"; + +export default class StationManager{ + constructor() { + this.setPage(); + addClickEventListener(document.getElementById("station-add-button"), () => {this.addStation()}); + } + + setPage() { + pageInit(); + addElement("h4", "μ—­ 이름"); + addInputElement("station-input-name", "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”"); + addElement("button", "μ—­ μΆ”κ°€", "id", "station-add-button"); + addElement("h2", "πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘"); + } + + setAlert(stationInputName) { + let text= "", isCorrect = true; + if(!isEmpty(stationInputName)) { + alert("μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”"); + isCorrect = false; + } + else if(stationInputName.length < 2) { + alert("μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”"); + isCorrect = false; + } + return isCorrect; + } + + addStation() { + const stationInputName = removeWhiteSpaceValue(document.getElementById("station-input-name").value); + if(this.setAlert(stationInputName)) { + addItem("stations", stationInputName); + console.log(localStorage.getItem("stations")); + } + } +} \ No newline at end of file diff --git a/src/style.css b/src/style.css new file mode 100644 index 000000000..033c9098a --- /dev/null +++ b/src/style.css @@ -0,0 +1,8 @@ +h4 { + margin-bottom: 0px; +} + +input { + margin-right: 5px; +} + From 5172c79580c8b7d2b6e96446098716ec88ffa11a Mon Sep 17 00:00:00 2001 From: maywngml Date: Fri, 11 Dec 2020 19:24:32 +0900 Subject: [PATCH 05/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20c?= =?UTF-8?q?ommon.js=EB=82=B4=20=EB=B3=80=EC=88=98=EC=99=80=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=93=A4=EC=9D=84=20=EA=B8=B0=EB=8A=A5=EB=B3=84?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC=ED=95=B4=EC=84=9C=20elements.js?= =?UTF-8?q?=EA=B3=BC=20items.js=EB=A1=9C=20=EB=82=98=EB=88=94,=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=AA=85=EA=B3=BC=20=EB=AC=B8=EC=9E=90=EB=93=A4?= =?UTF-8?q?=EC=9D=84=20=EC=83=81=EC=88=98=ED=99=94=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/elements.js | 26 ++++++++++++++++++++++++++ src/{common.js => common/items.js} | 25 ------------------------- src/common/words.js | 17 +++++++++++++++++ src/index.js | 2 +- src/station-manager.js | 27 +++++++++++++++------------ 5 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 src/common/elements.js rename src/{common.js => common/items.js} (57%) create mode 100644 src/common/words.js diff --git a/src/common/elements.js b/src/common/elements.js new file mode 100644 index 000000000..be8d3832a --- /dev/null +++ b/src/common/elements.js @@ -0,0 +1,26 @@ +export const managerPart = document.getElementById("manager-part"); + +export function addClickEventListener(target, listener) { + target.addEventListener("click", listener); +} + +export function addElement(type, content, attribute, attributeName) { + const element = document.createElement(type); + element.append(content); + element.setAttribute(attribute, attributeName); + managerPart.append(element); +} + +export function addInputElement(name, information) { + const element = document.createElement("input"); + element.setAttribute("type", "text"); + element.setAttribute("id", name); + element.setAttribute("placeholder", information); + managerPart.append(element); +} + +// export function addTableElement(name, ) + +export function pageInit() { + managerPart.innerHTML = ""; +} \ No newline at end of file diff --git a/src/common.js b/src/common/items.js similarity index 57% rename from src/common.js rename to src/common/items.js index a0b1ec545..9a8f82453 100644 --- a/src/common.js +++ b/src/common/items.js @@ -1,28 +1,3 @@ -export const managerPart = document.getElementById("manager-part"); - -export function addClickEventListener(target, listener) { - target.addEventListener("click", listener); -} - -export function addElement(type, content, attribute, attributeName) { - const element = document.createElement(type); - element.append(content); - element.setAttribute(attribute, attributeName); - managerPart.append(element); -} - -export function addInputElement(name, information) { - const element = document.createElement("input"); - element.setAttribute("type", "text"); - element.setAttribute("id", name); - element.setAttribute("placeholder", information); - managerPart.append(element); -} - -export function pageInit() { - managerPart.innerHTML = ""; -} - export function removeWhiteSpaceValue(value) { return value.replace(/^\s+|\s+$/gm, ''); } diff --git a/src/common/words.js b/src/common/words.js new file mode 100644 index 000000000..bc26edce1 --- /dev/null +++ b/src/common/words.js @@ -0,0 +1,17 @@ +const words = { + STATIONS: "stations", + STATION_NAME: "μ—­ 이름", + STATION_LIST: "πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘", + STATION_ADD: "μ—­ μΆ”κ°€", + STATION_INPUT_ALERT: "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.", + STATION_LENGTH_ALERT: "μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”.", + STATION_NAME_INPUT: "station-name-input", + STATION_ADD_BUTTON: "station-add-button", + STATION_DELETE_BUTTON: "station-delete-button", + + DELETE: "μ‚­μ œ", + DELETE_ALERT: "μ •λ§λ‘œ μ‚­μ œν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?", + SETTING: "μ„€μ •" +} + +export default words; \ No newline at end of file diff --git a/src/index.js b/src/index.js index 023a59754..8a4862de8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -import {addClickEventListener} from './common.js' +import {addClickEventListener} from './common/elements.js' import StationManager from './station-manager.js'; // import LineManager from './line-manager.js'; // import SectionManager from './section-manager.js'; diff --git a/src/station-manager.js b/src/station-manager.js index b5915983b..a45688156 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -3,11 +3,14 @@ import { addInputElement, addClickEventListener, pageInit, - managerPart, + managerPart +} from "./common/elements.js"; +import { isEmpty, addItem, - removeWhiteSpaceValue -} from "./common.js"; + removeWhiteSpaceValue} +from "./common/items.js"; +import words from "./common/words.js"; export default class StationManager{ constructor() { @@ -17,30 +20,30 @@ export default class StationManager{ setPage() { pageInit(); - addElement("h4", "μ—­ 이름"); - addInputElement("station-input-name", "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”"); - addElement("button", "μ—­ μΆ”κ°€", "id", "station-add-button"); - addElement("h2", "πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘"); + addElement("h4", words.STATION_NAME); + addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT); + addElement("button", words.STATION_NAME, "id",words.STATION_ADD_BUTTON); + addElement("h2", words.STATION_LIST); + // addTableElement([words.STATION_NAME, words.SETTING]); } setAlert(stationInputName) { let text= "", isCorrect = true; if(!isEmpty(stationInputName)) { - alert("μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”"); + alert(words.STATION_INPUT_ALERT); isCorrect = false; } else if(stationInputName.length < 2) { - alert("μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”"); + alert(words.STATION_LENGTH_ALERT); isCorrect = false; } return isCorrect; } addStation() { - const stationInputName = removeWhiteSpaceValue(document.getElementById("station-input-name").value); + const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); if(this.setAlert(stationInputName)) { - addItem("stations", stationInputName); - console.log(localStorage.getItem("stations")); + addItem(words.STATIONS, stationInputName); } } } \ No newline at end of file From 179bab45760181c683a3f69a96b6eb8885edcde9 Mon Sep 17 00:00:00 2001 From: maywngml Date: Sat, 12 Dec 2020 14:30:28 +0900 Subject: [PATCH 06/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EC=97=AD=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/elements.js | 12 +++++++--- src/common/items.js | 4 +++- src/common/words.js | 4 +++- src/station-manager.js | 54 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/common/elements.js b/src/common/elements.js index be8d3832a..9e106d818 100644 --- a/src/common/elements.js +++ b/src/common/elements.js @@ -4,11 +4,12 @@ export function addClickEventListener(target, listener) { target.addEventListener("click", listener); } -export function addElement(type, content, attribute, attributeName) { +export function addElement(type, content, attribute, attributeName, parentNode) { const element = document.createElement(type); element.append(content); element.setAttribute(attribute, attributeName); - managerPart.append(element); + parentNode = parentNode === null ? managerPart : parentNode; + parentNode.append(element); } export function addInputElement(name, information) { @@ -19,7 +20,12 @@ export function addInputElement(name, information) { managerPart.append(element); } -// export function addTableElement(name, ) +export function addTableElement(idName) { + const element = document.createElement("table"); + element.setAttribute("id", idName); + element.setAttribute("border", 1); + managerPart.append(element); +} export function pageInit() { managerPart.innerHTML = ""; diff --git a/src/common/items.js b/src/common/items.js index 9a8f82453..0e896dfb7 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -14,7 +14,6 @@ export function isEmpty(value) { export function itemDuplicateCheck(itemList, value) { let isDuplicate = false; if(itemList.includes(value)) { - alert(`${value}은 이미 λ“±λ‘λœ μ΄λ¦„μž…λ‹ˆλ‹€`); isDuplicate = true; } return isDuplicate; @@ -26,6 +25,7 @@ export function getItemList(key) { export function addItem(key, value) { let itemList = getItemList(key); + let isComplete = false; // μˆ˜μ • - 더 효율적으둜 μˆ˜μ •ν•˜κΈ° if(itemList === null){ itemList = []; @@ -33,5 +33,7 @@ export function addItem(key, value) { if(!itemDuplicateCheck(itemList, value)){ itemList.push(value); localStorage.setItem(key, JSON.stringify(itemList)); + isComplete = true; } + return isComplete; } \ No newline at end of file diff --git a/src/common/words.js b/src/common/words.js index bc26edce1..0912c0cf4 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -2,16 +2,18 @@ const words = { STATIONS: "stations", STATION_NAME: "μ—­ 이름", STATION_LIST: "πŸš‰ μ§€ν•˜μ²  μ—­ λͺ©λ‘", + STATION_LIST_HEADER: ["μ—­ 이름", "μ„€μ •"], STATION_ADD: "μ—­ μΆ”κ°€", STATION_INPUT_ALERT: "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.", STATION_LENGTH_ALERT: "μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”.", STATION_NAME_INPUT: "station-name-input", STATION_ADD_BUTTON: "station-add-button", STATION_DELETE_BUTTON: "station-delete-button", + STATION_TABLE: "station-table", DELETE: "μ‚­μ œ", DELETE_ALERT: "μ •λ§λ‘œ μ‚­μ œν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?", - SETTING: "μ„€μ •" + SETTING: "μ„€μ •", } export default words; \ No newline at end of file diff --git a/src/station-manager.js b/src/station-manager.js index a45688156..d8225edf3 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -1,13 +1,14 @@ import { addElement, - addInputElement, + addInputElement, + addTableElement, addClickEventListener, - pageInit, - managerPart + pageInit } from "./common/elements.js"; import { isEmpty, addItem, + getItemList, removeWhiteSpaceValue} from "./common/items.js"; import words from "./common/words.js"; @@ -15,20 +16,51 @@ import words from "./common/words.js"; export default class StationManager{ constructor() { this.setPage(); - addClickEventListener(document.getElementById("station-add-button"), () => {this.addStation()}); + this.stationTable = document.getElementById(words.STATION_TABLE); + this.resetTable(); + addClickEventListener(document.getElementById(words.STATION_ADD_BUTTON), () => {this.addStation()}); + } + + setTableContent() { + const stationList = getItemList(words.STATIONS); + let content = ""; + if(stationList !== null) { + stationList.forEach(station => { + content += `${station} + `; + }); + //addClickEventListener(document.getElementsByClassName(words.STATION_DELETE_BUTTON), () => {this.deleteStation()}); + } + this.stationTable.innerHTML += content; + } + + resetTable() { + let content = ""; + this.stationTable.innerHTML = ""; + words.STATION_LIST_HEADER.forEach(header => { + content += `${header}`; + }) + this.stationTable.innerHTML += content; + this.setTableContent(); + } + + addStationInTable(station) { + let content = `${station} + `; + this.stationTable.innerHTML += content; } setPage() { pageInit(); - addElement("h4", words.STATION_NAME); + addElement("h4", words.STATION_NAME, null, null, null); addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT); - addElement("button", words.STATION_NAME, "id",words.STATION_ADD_BUTTON); - addElement("h2", words.STATION_LIST); - // addTableElement([words.STATION_NAME, words.SETTING]); + addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); + addElement("h2", words.STATION_LIST, null, null, null); + addTableElement(words.STATION_TABLE); } setAlert(stationInputName) { - let text= "", isCorrect = true; + let isCorrect = true; if(!isEmpty(stationInputName)) { alert(words.STATION_INPUT_ALERT); isCorrect = false; @@ -43,7 +75,9 @@ export default class StationManager{ addStation() { const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); if(this.setAlert(stationInputName)) { - addItem(words.STATIONS, stationInputName); + if(addItem(words.STATIONS, stationInputName)) { + this.addStationInTable(stationInputName); + } } } } \ No newline at end of file From 8bc578eadb3ec36c92bae77a4077fdc24e2894a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9C=EC=A3=BC=ED=9D=AC?= <50205928+maywngml@users.noreply.github.com> Date: Sun, 13 Dec 2020 03:25:18 +0900 Subject: [PATCH 07/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EC=A7=80=ED=95=98?= =?UTF-8?q?=EC=B2=A0=20=EB=85=B8=EC=84=A0=20=EB=93=B1=EB=A1=9D=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=A1=B0=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c3fb458f4..1a08d12e9 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ ### μ§€ν•˜μ²  λ…Έμ„  κ΄€λ ¨ κΈ°λŠ₯ - μ§€ν•˜μ²  노선을 λ“±λ‘ν•œλ‹€. - λ…Έμ„ μ˜ 쀑볡 μ—¬λΆ€λ₯Ό 확인해야 ν•œλ‹€. + - 상행쒅점역과 ν•˜ν–‰μ’…μ μ—­μ€ μ§€ν•˜μ²  μ—­ λͺ©λ‘μ˜ 첫번째 값이 기본값이닀. - μ§€ν•˜μ²  노선을 μ‚­μ œν•œλ‹€. - μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. - λ…Έμ„  이름, 상행 쒅점역, ν•˜ν–‰ 쒅점역을 μ‘°νšŒν•΄μ•Ό ν•œλ‹€. From b94d23375557c11e4b4064da8475e30d431920d4 Mon Sep 17 00:00:00 2001 From: maywngml Date: Sun, 13 Dec 2020 04:00:13 +0900 Subject: [PATCH 08/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EB=85=B8=EC=84=A0=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- src/common/elements.js | 44 +++++++++++++++++++--- src/common/words.js | 20 +++++++++- src/index.js | 3 +- src/line-manager.js | 83 ++++++++++++++++++++++++++++++++++++++++++ src/station-manager.js | 64 ++++++++++++++++---------------- src/style.css | 16 ++++++++ 7 files changed, 191 insertions(+), 41 deletions(-) create mode 100644 src/line-manager.js diff --git a/index.html b/index.html index e8c3a3199..eeab57423 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + μ§€ν•˜μ²  노선도 관리 diff --git a/src/common/elements.js b/src/common/elements.js index 9e106d818..451926211 100644 --- a/src/common/elements.js +++ b/src/common/elements.js @@ -1,13 +1,20 @@ +import {getItemList} from "./items.js"; +import words from "./words.js"; + export const managerPart = document.getElementById("manager-part"); -export function addClickEventListener(target, listener) { - target.addEventListener("click", listener); +export function addClickEventListener(target, event) { + target.addEventListener("click", event); } export function addElement(type, content, attribute, attributeName, parentNode) { const element = document.createElement(type); - element.append(content); - element.setAttribute(attribute, attributeName); + if(content !== null) { + element.append(content); + } + if(attribute !== null) { + element.setAttribute(attribute, attributeName); + } parentNode = parentNode === null ? managerPart : parentNode; parentNode.append(element); } @@ -20,13 +27,38 @@ export function addInputElement(name, information) { managerPart.append(element); } -export function addTableElement(idName) { +export function addTableElement(headers, tbodyName) { const element = document.createElement("table"); - element.setAttribute("id", idName); element.setAttribute("border", 1); + headers.forEach(header => { + addElement("th", header, null, null, element); + }) + addElement("tbody", null, "id", tbodyName, element); + managerPart.append(element); +} + +export function addSelectElement(idName) { + const stationList = getItemList(words.STATIONS); + const element = document.createElement("select"); + element.setAttribute("id", idName); + if(stationList !== null) { + stationList.forEach(station => { + const option = document.createElement("option"); + option.setAttribute("value", station); + option.append(station); + element.append(option); + }); + } managerPart.append(element); } +export function addClickEventInDeleteButton(buttonName, event) { + const deleteButtons = document.getElementsByClassName(buttonName); + for(let i=0; i {new StationManager()}); + addClickEventListener(lineManagerButton, () => {new LineManager()}); } new stationPageInit(); diff --git a/src/line-manager.js b/src/line-manager.js new file mode 100644 index 000000000..83fc1351f --- /dev/null +++ b/src/line-manager.js @@ -0,0 +1,83 @@ +import { + addElement, + addInputElement, + addTableElement, + addSelectElement, + addClickEventListener, + pageInit, + addClickEventInDeleteButton +} from "./common/elements.js"; +import { + isEmpty, + addItem, + getItemList, + removeWhiteSpaceValue +} from "./common/items.js"; +import words from "./common/words.js"; + +export default class LineManager { + constructor() { + this.setPage(); + this.lineTableTbody = document.getElementById("line-table-tbody"); + // this.setTableContent(); + addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); + } + + setPage() { + pageInit(); + addElement("h4", words.LINE_NAME, null, null, null); + addInputElement(words.LINE_NAME_INPUT, words.LINE_INPUT_ALERT); + addElement("h4", words.LINE_START_STATION, "class", words.LINE_STATION_TEXT, null); + addSelectElement(words.LINE_START_STATION_SELECTOR); + addElement("br", null, null, null, null); + addElement("h4", words.LINE_END_STATION, "class", words.LINE_STATION_TEXT, null); + addSelectElement(words.LINE_END_STATION_SELECTOR); + addElement("p", null, null, null, null); + addElement("button", words.LINE_ADD, "id",words.LINE_ADD_BUTTON, null); + addElement("h2", words.LINE_LIST, null, null, null); + addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY); + } + + addLineSection(stationInputName, lineStartStationName, lineEndStationName) { + const itemList = [lineStartStationName, lineEndStationName]; + localStorage.setItem(stationInputName, JSON.stringify(itemList)); + } + + addLineInTable(stationInputName) { + const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); + const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); + const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; + const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; + const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + const cell4 = row.insertCell(3); + cell1.innerHTML = stationInputName; + cell2.innerHTML = lineStartStationName; + cell3.innerHTML = lineEndStationName; + addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); + this.addLineSection(stationInputName, lineStartStationName, lineEndStationName); + } + + setAlert(stationInputName) { + let isCorrect = true; + if(!isEmpty(stationInputName)) { + alert(words.LINE_INPUT_ALERT); + isCorrect = false; + } + return isCorrect; + } + + addLine() { + const lineInputName = removeWhiteSpaceValue(document.getElementById(words.LINE_NAME_INPUT).value); + if(this.setAlert(lineInputName)) { + if(addItem(words.LINES, lineInputName)) { + this.addLineInTable(lineInputName); + } + else { + alert(`${lineInputName}${words.LINE_DUPLICATE_ALERT}`); + } + } + } +} \ No newline at end of file diff --git a/src/station-manager.js b/src/station-manager.js index d8225edf3..7b14667e8 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -3,60 +3,59 @@ import { addInputElement, addTableElement, addClickEventListener, - pageInit + pageInit, + addClickEventInDeleteButton } from "./common/elements.js"; import { isEmpty, addItem, getItemList, removeWhiteSpaceValue} -from "./common/items.js"; +from "./common/items.js?ver=102"; import words from "./common/words.js"; export default class StationManager{ constructor() { this.setPage(); - this.stationTable = document.getElementById(words.STATION_TABLE); - this.resetTable(); + this.stationTableTbody = document.getElementById(words.STATION_TABLE_TBODY); + this.setTableContent(); addClickEventListener(document.getElementById(words.STATION_ADD_BUTTON), () => {this.addStation()}); } + setPage() { + pageInit(); + addElement("h4", words.STATION_NAME, null, null, null); + addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT); + addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); + addElement("h2", words.STATION_LIST, null, null, null); + addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY); + } + + // μˆ˜μ •ν•΄μ•Όν•¨ + deleteStation() { + alert("delete"); + } + setTableContent() { const stationList = getItemList(words.STATIONS); - let content = ""; if(stationList !== null) { stationList.forEach(station => { - content += `${station} - `; + const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + cell1.innerHTML = station; + addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); }); - //addClickEventListener(document.getElementsByClassName(words.STATION_DELETE_BUTTON), () => {this.deleteStation()}); } - this.stationTable.innerHTML += content; - } - - resetTable() { - let content = ""; - this.stationTable.innerHTML = ""; - words.STATION_LIST_HEADER.forEach(header => { - content += `${header}`; - }) - this.stationTable.innerHTML += content; - this.setTableContent(); + addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); } addStationInTable(station) { - let content = `${station} - `; - this.stationTable.innerHTML += content; - } - - setPage() { - pageInit(); - addElement("h4", words.STATION_NAME, null, null, null); - addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT); - addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); - addElement("h2", words.STATION_LIST, null, null, null); - addTableElement(words.STATION_TABLE); + const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + cell1.innerHTML = station; + addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); } setAlert(stationInputName) { @@ -78,6 +77,9 @@ export default class StationManager{ if(addItem(words.STATIONS, stationInputName)) { this.addStationInTable(stationInputName); } + else { + alert(`${stationInputName}${words.STATION_DUPLICATE_ALERT}`); + } } } } \ No newline at end of file diff --git a/src/style.css b/src/style.css index 033c9098a..abdc6417b 100644 --- a/src/style.css +++ b/src/style.css @@ -6,3 +6,19 @@ input { margin-right: 5px; } +select { + margin-left: 5px; +} + +#line-name-input { + margin-bottom: 20px; + display: block; +} + +.line-station-text { + display: inline; +} + + + + From 7ec665c7b141b92e1a3019e207b9e113b1e84cb3 Mon Sep 17 00:00:00 2001 From: maywngml Date: Sun, 13 Dec 2020 04:21:26 +0900 Subject: [PATCH 09/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EB=85=B8=EC=84=A0=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/line-manager.js | 29 ++++++++++++++++++++++++++--- src/station-manager.js | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/line-manager.js b/src/line-manager.js index 83fc1351f..7524400d8 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -18,9 +18,10 @@ import words from "./common/words.js"; export default class LineManager { constructor() { this.setPage(); - this.lineTableTbody = document.getElementById("line-table-tbody"); - // this.setTableContent(); - addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); + this.lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); + this.setTableContent(); + addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); + // addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine()); } setPage() { @@ -37,6 +38,28 @@ export default class LineManager { addElement("h2", words.LINE_LIST, null, null, null); addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY); } + // μˆ˜μ •ν•΄μ•Όν•¨ + deleteLine() { + console.log("delete"); + } + + setTableContent() { + const lineList = getItemList(words.LINES); + if(lineList !== null) { + lineList.forEach(line => { + const lineSectionList = getItemList(line); + const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + const cell4 = row.insertCell(3); + cell1.innerHTML = line; + cell2.innerHTML = lineSectionList[0]; + cell3.innerHTML = lineSectionList[lineSectionList.length - 1]; + addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); + }); + } + } addLineSection(stationInputName, lineStartStationName, lineEndStationName) { const itemList = [lineStartStationName, lineEndStationName]; diff --git a/src/station-manager.js b/src/station-manager.js index 7b14667e8..a100b8ce6 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -11,7 +11,7 @@ import { addItem, getItemList, removeWhiteSpaceValue} -from "./common/items.js?ver=102"; +from "./common/items.js"; import words from "./common/words.js"; export default class StationManager{ From ae9fcf46367c38555e8423e7d0542d927a2e04df Mon Sep 17 00:00:00 2001 From: maywngml Date: Mon, 14 Dec 2020 11:24:23 +0900 Subject: [PATCH 10/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=ED=96=89=EC=9D=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=83=88=EB=A1=9C=20=EC=83=9D=EC=84=B1=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 4 ++-- src/common/words.js | 2 +- src/line-manager.js | 48 ++++++++++++++++++++---------------------- src/station-manager.js | 23 ++++++++++---------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/common/items.js b/src/common/items.js index 0e896dfb7..e59f9357c 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -11,7 +11,7 @@ export function isEmpty(value) { return result; } -export function itemDuplicateCheck(itemList, value) { +export function isItemDuplicate(itemList, value) { let isDuplicate = false; if(itemList.includes(value)) { isDuplicate = true; @@ -30,7 +30,7 @@ export function addItem(key, value) { if(itemList === null){ itemList = []; } - if(!itemDuplicateCheck(itemList, value)){ + if(!isItemDuplicate(itemList, value)){ itemList.push(value); localStorage.setItem(key, JSON.stringify(itemList)); isComplete = true; diff --git a/src/common/words.js b/src/common/words.js index 1efa4864b..8bb90ed17 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -5,7 +5,7 @@ const words = { STATION_ADD: "μ—­ μΆ”κ°€", STATION_INPUT_ALERT: "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.", STATION_LENGTH_ALERT: "μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”.", - STATION_DUPLICATE_ALERT: "은 이미 λ“±λ‘λœ μ—­μž…λ‹ˆλ‹€.", + STATION_DUPLICATE_ALERT: "역은 이미 λ“±λ‘λœ μ—­μž…λ‹ˆλ‹€.", STATION_NAME_INPUT: "station-name-input", STATION_ADD_BUTTON: "station-add-button", STATION_DELETE_BUTTON: "station-delete-button", diff --git a/src/line-manager.js b/src/line-manager.js index 7524400d8..820da9200 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -21,7 +21,7 @@ export default class LineManager { this.lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); this.setTableContent(); addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); - // addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine()); + } setPage() { @@ -43,49 +43,47 @@ export default class LineManager { console.log("delete"); } + addTableRow(lineName, lineStartStationName, lineEndStationName) { + const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + const cell4 = row.insertCell(3); + cell1.innerHTML = lineName; + cell2.innerHTML = lineStartStationName; + cell3.innerHTML = lineEndStationName; + addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); + } + setTableContent() { const lineList = getItemList(words.LINES); if(lineList !== null) { lineList.forEach(line => { const lineSectionList = getItemList(line); - const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - const cell3 = row.insertCell(2); - const cell4 = row.insertCell(3); - cell1.innerHTML = line; - cell2.innerHTML = lineSectionList[0]; - cell3.innerHTML = lineSectionList[lineSectionList.length - 1]; - addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); + this.addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); }); + addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine); } } - addLineSection(stationInputName, lineStartStationName, lineEndStationName) { + addLineSection(lineInputName, lineStartStationName, lineEndStationName) { const itemList = [lineStartStationName, lineEndStationName]; - localStorage.setItem(stationInputName, JSON.stringify(itemList)); + localStorage.setItem(lineInputName, JSON.stringify(itemList)); } - addLineInTable(stationInputName) { + addLineInTable(lineInputName) { const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; - const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - const cell3 = row.insertCell(2); - const cell4 = row.insertCell(3); - cell1.innerHTML = stationInputName; - cell2.innerHTML = lineStartStationName; - cell3.innerHTML = lineEndStationName; - addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); - this.addLineSection(stationInputName, lineStartStationName, lineEndStationName); + this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); + this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); + addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine); } - setAlert(stationInputName) { + setAlert(lineInputName) { let isCorrect = true; - if(!isEmpty(stationInputName)) { + if(!isEmpty(lineInputName)) { alert(words.LINE_INPUT_ALERT); isCorrect = false; } diff --git a/src/station-manager.js b/src/station-manager.js index a100b8ce6..8a3bc8416 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -36,26 +36,27 @@ export default class StationManager{ alert("delete"); } + addTableRow(station) { + const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + cell1.innerHTML = station; + addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); + } + setTableContent() { const stationList = getItemList(words.STATIONS); if(stationList !== null) { stationList.forEach(station => { - const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - cell1.innerHTML = station; - addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); + this.addTableRow(station); }); + addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); } - addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); } addStationInTable(station) { - const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - cell1.innerHTML = station; - addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); + this.addTableRow(station); + addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); } setAlert(stationInputName) { From c80456ff0fdcf0732847a44e7b40d3f407000239 Mon Sep 17 00:00:00 2001 From: maywngml Date: Mon, 14 Dec 2020 20:27:01 +0900 Subject: [PATCH 11/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EB=85=B8=EC=84=A0=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/elements.js | 16 +++++++++++----- src/common/items.js | 13 ++++++++++++- src/common/words.js | 1 + src/line-manager.js | 32 ++++++++++++++++++++++++-------- 4 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/common/elements.js b/src/common/elements.js index 451926211..a53704918 100644 --- a/src/common/elements.js +++ b/src/common/elements.js @@ -52,13 +52,19 @@ export function addSelectElement(idName) { managerPart.append(element); } -export function addClickEventInDeleteButton(buttonName, event) { - const deleteButtons = document.getElementsByClassName(buttonName); - for(let i=0; i {event(deleteButtons[length-1])}); + } + else { + deleteButtons.forEach(deleteButton => { + addClickEventListener(deleteButton, () => {event(deleteButton)}); + }) } } export function pageInit() { - managerPart.innerHTML = ""; + managerPart.innerHTML = ""; } \ No newline at end of file diff --git a/src/common/items.js b/src/common/items.js index e59f9357c..73c9d7e8c 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -36,4 +36,15 @@ export function addItem(key, value) { isComplete = true; } return isComplete; -} \ No newline at end of file +} + +export function deleteKey(key) { + localStorage.removeItem(key); +} + +export function deleteItem(key, value) { + let itemList = getItemList(key); + itemList.splice(itemList.indexOf(value), 1); + localStorage.setItem(key, JSON.stringify(itemList)); +} + diff --git a/src/common/words.js b/src/common/words.js index 8bb90ed17..bdfd33f27 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -19,6 +19,7 @@ const words = { LINE_ADD: "λ…Έμ„  μΆ”κ°€", LINE_INPUT_ALERT: "λ…Έμ„  이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.", LINE_DUPLICATE_ALERT: "은 이미 λ“±λ‘λœ λ…Έμ„ μž…λ‹ˆλ‹€.", + LINE_SAME_STATION_ALERT:"상행쒅점역과 ν•˜ν–‰μ’…μ μ—­μ„ λ‹€λ₯΄κ²Œ μ„ νƒν•΄μ£Όμ„Έμš”.", LINE_NAME_INPUT: "line-name-input", LINE_STATION_TEXT: "line-station-text", LINE_START_STATION_SELECTOR: "line-start-station-selector", diff --git a/src/line-manager.js b/src/line-manager.js index 820da9200..d67288765 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -11,7 +11,9 @@ import { isEmpty, addItem, getItemList, - removeWhiteSpaceValue + removeWhiteSpaceValue, + deleteKey, + deleteItem } from "./common/items.js"; import words from "./common/words.js"; @@ -21,7 +23,6 @@ export default class LineManager { this.lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); this.setTableContent(); addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); - } setPage() { @@ -38,13 +39,28 @@ export default class LineManager { addElement("h2", words.LINE_LIST, null, null, null); addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY); } - // μˆ˜μ •ν•΄μ•Όν•¨ - deleteLine() { - console.log("delete"); + + deleteLine(deleteButton) { + const deleteRow = deleteButton.parentElement.parentElement; + const lineName = deleteRow.dataset.lineName + this.lineTableTbody.removeChild(deleteRow); + deleteKey(lineName); + deleteItem(words.LINES, lineName); + if(this.lineTableTbody.childElementCount === 0) { + deleteKey(words.LINES); + } + } + + confirmDeleteLine(deleteButton) { + const isConfirm = confirm(words.DELETE_ALERT); + if(isConfirm) { + this.deleteLine(deleteButton); + } } addTableRow(lineName, lineStartStationName, lineEndStationName) { const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); + row.setAttribute("data-line-name", lineName); const cell1 = row.insertCell(0); const cell2 = row.insertCell(1); const cell3 = row.insertCell(2); @@ -62,14 +78,14 @@ export default class LineManager { const lineSectionList = getItemList(line); this.addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); }); - addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine); + addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), false); } } addLineSection(lineInputName, lineStartStationName, lineEndStationName) { const itemList = [lineStartStationName, lineEndStationName]; localStorage.setItem(lineInputName, JSON.stringify(itemList)); - } + } addLineInTable(lineInputName) { const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); @@ -78,7 +94,7 @@ export default class LineManager { const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); - addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.deleteLine); + addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } setAlert(lineInputName) { From 43a7f9a26c2f8716cf363d2f5d2d4210139f5d4d Mon Sep 17 00:00:00 2001 From: maywngml Date: Mon, 14 Dec 2020 20:35:26 +0900 Subject: [PATCH 12/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=20=EC=B6=94=EA=B0=80=EC=8B=9C=20=EC=83=81?= =?UTF-8?q?=ED=96=89=EC=A2=85=EC=A0=90=EC=97=AD=EA=B3=BC=20=ED=95=98?= =?UTF-8?q?=ED=96=89=EC=A2=85=EC=A0=90=EC=97=AD=EC=9D=80=20=EB=8B=A4?= =?UTF-8?q?=EB=A5=B4=EA=B2=8C=20=EC=9E=85=EB=A0=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20alert=EC=B0=BD=20?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EB=8A=94=20=EB=B0=A9=EC=8B=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/line-manager.js | 30 ++++++++++++++++++++---------- src/station-manager.js | 18 ++++++++++-------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/line-manager.js b/src/line-manager.js index d67288765..021af3f7b 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -6,7 +6,7 @@ import { addClickEventListener, pageInit, addClickEventInDeleteButton -} from "./common/elements.js"; +} from "./common/elements.js?ver=24"; import { isEmpty, addItem, @@ -14,8 +14,8 @@ import { removeWhiteSpaceValue, deleteKey, deleteItem -} from "./common/items.js"; -import words from "./common/words.js"; +} from "./common/items.js?ver=15"; +import words from "./common/words.js?ver=1"; export default class LineManager { constructor() { @@ -42,7 +42,7 @@ export default class LineManager { deleteLine(deleteButton) { const deleteRow = deleteButton.parentElement.parentElement; - const lineName = deleteRow.dataset.lineName + const lineName = deleteRow.dataset.lineName; this.lineTableTbody.removeChild(deleteRow); deleteKey(lineName); deleteItem(words.LINES, lineName); @@ -97,18 +97,25 @@ export default class LineManager { addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } - setAlert(lineInputName) { - let isCorrect = true; + getAlertText(lineInputName) { + const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); + const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); + const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; + const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; + let text = ""; if(!isEmpty(lineInputName)) { - alert(words.LINE_INPUT_ALERT); - isCorrect = false; + text = words.LINE_INPUT_ALERT; + } + else if(lineStartStationName === lineEndStationName) { + text = words.LINE_SAME_STATION_ALERT; } - return isCorrect; + return text; } addLine() { const lineInputName = removeWhiteSpaceValue(document.getElementById(words.LINE_NAME_INPUT).value); - if(this.setAlert(lineInputName)) { + const alertText = this.getAlertText(lineInputName); + if(alertText === "") { if(addItem(words.LINES, lineInputName)) { this.addLineInTable(lineInputName); } @@ -116,5 +123,8 @@ export default class LineManager { alert(`${lineInputName}${words.LINE_DUPLICATE_ALERT}`); } } + else { + alert(alertText); + } } } \ No newline at end of file diff --git a/src/station-manager.js b/src/station-manager.js index 8a3bc8416..f8818ee47 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -59,22 +59,21 @@ export default class StationManager{ addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); } - setAlert(stationInputName) { - let isCorrect = true; + getAlertText(stationInputName) { + let text = ""; if(!isEmpty(stationInputName)) { - alert(words.STATION_INPUT_ALERT); - isCorrect = false; + text = words.STATION_INPUT_ALERT; } else if(stationInputName.length < 2) { - alert(words.STATION_LENGTH_ALERT); - isCorrect = false; + text = words.STATION_LENGTH_ALERT; } - return isCorrect; + return text; } addStation() { const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); - if(this.setAlert(stationInputName)) { + const alertText = this.getAlertText(stationInputName); + if(alertText === "") { if(addItem(words.STATIONS, stationInputName)) { this.addStationInTable(stationInputName); } @@ -82,5 +81,8 @@ export default class StationManager{ alert(`${stationInputName}${words.STATION_DUPLICATE_ALERT}`); } } + else { + alert(alertText); + } } } \ No newline at end of file From 56b9315e6894396462da0443051eb101c498aa81 Mon Sep 17 00:00:00 2001 From: maywngml Date: Mon, 14 Dec 2020 20:45:29 +0900 Subject: [PATCH 13/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=9D=98=20=EC=83=81=ED=96=89=EC=A2=85?= =?UTF-8?q?=EC=A0=90=EC=97=AD,=20=ED=95=98=ED=96=89=EC=A2=85=EC=A0=90?= =?UTF-8?q?=EC=97=AD=EC=9D=84=20=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=83=9D=EC=84=B1=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 1 + src/line-manager.js | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/index.js b/src/index.js index 6a488df57..fb66ac782 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,7 @@ export default function stationPageInit() { const mapPrintManagerButton = document.getElementById('map-print-manager-button'); addClickEventListener(stationManagerButton, () => {new StationManager()}); addClickEventListener(lineManagerButton, () => {new LineManager()}); + // addClickEventListener(lineManagerButton, () => {new LineManager()}); } new stationPageInit(); diff --git a/src/line-manager.js b/src/line-manager.js index 021af3f7b..8a0da11ac 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -6,7 +6,7 @@ import { addClickEventListener, pageInit, addClickEventInDeleteButton -} from "./common/elements.js?ver=24"; +} from "./common/elements.js"; import { isEmpty, addItem, @@ -14,8 +14,8 @@ import { removeWhiteSpaceValue, deleteKey, deleteItem -} from "./common/items.js?ver=15"; -import words from "./common/words.js?ver=1"; +} from "./common/items.js"; +import words from "./common/words.js"; export default class LineManager { constructor() { @@ -87,21 +87,12 @@ export default class LineManager { localStorage.setItem(lineInputName, JSON.stringify(itemList)); } - addLineInTable(lineInputName) { - const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); - const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); - const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; - const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; - this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); + addLineInTable(lineInputName, lineStartStationName, lineEndStationName) {this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } getAlertText(lineInputName) { - const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); - const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); - const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; - const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; let text = ""; if(!isEmpty(lineInputName)) { text = words.LINE_INPUT_ALERT; @@ -112,12 +103,21 @@ export default class LineManager { return text; } + getLineStationName() { + const lineStartStationSelector = document.getElementById(words.LINE_START_STATION_SELECTOR); + const lineEndStationSelector = document.getElementById(words.LINE_END_STATION_SELECTOR); + const lineStartStationName = lineStartStationSelector.options[lineStartStationSelector.selectedIndex].value; + const lineEndStationName = lineEndStationSelector.options[lineEndStationSelector.selectedIndex].value; + return [lineStartStationName, lineEndStationName]; + } + addLine() { const lineInputName = removeWhiteSpaceValue(document.getElementById(words.LINE_NAME_INPUT).value); - const alertText = this.getAlertText(lineInputName); + const lineStationName = getLineStationName(); + const alertText = this.getAlertText(lineInputName, lineStationName[0], lineStationName[1]); if(alertText === "") { if(addItem(words.LINES, lineInputName)) { - this.addLineInTable(lineInputName); + this.addLineInTable(lineInputName, lineStationName[0], lineStationName[1]); } else { alert(`${lineInputName}${words.LINE_DUPLICATE_ALERT}`); From febb5fe516143c873a738cef96ebf25a31c440b1 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 01:09:56 +0900 Subject: [PATCH 14/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=97=90=20=EB=93=B1=EB=A1=9D=EB=90=9C=20?= =?UTF-8?q?=EC=97=AD=EC=9D=98=20=EB=AA=A9=EB=A1=9D=EC=9D=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/elements.js | 34 +++++++++------- src/common/words.js | 16 ++++++++ src/index.js | 4 +- src/line-manager.js | 20 +++++----- src/section-manager.js | 88 ++++++++++++++++++++++++++++++++++++++++++ src/station-manager.js | 12 +++--- src/style.css | 18 +++++++-- 7 files changed, 155 insertions(+), 37 deletions(-) create mode 100644 src/section-manager.js diff --git a/src/common/elements.js b/src/common/elements.js index a53704918..f4e8daa0a 100644 --- a/src/common/elements.js +++ b/src/common/elements.js @@ -7,6 +7,11 @@ export function addClickEventListener(target, event) { target.addEventListener("click", event); } +function appendNode(childNode, parentNode) { + parentNode = parentNode === null ? managerPart : parentNode; + parentNode.append(childNode); +} + export function addElement(type, content, attribute, attributeName, parentNode) { const element = document.createElement(type); if(content !== null) { @@ -15,32 +20,31 @@ export function addElement(type, content, attribute, attributeName, parentNode) if(attribute !== null) { element.setAttribute(attribute, attributeName); } - parentNode = parentNode === null ? managerPart : parentNode; - parentNode.append(element); + appendNode(element, parentNode); } -export function addInputElement(name, information) { +export function addInputElement(name, information, parentNode) { const element = document.createElement("input"); element.setAttribute("type", "text"); element.setAttribute("id", name); element.setAttribute("placeholder", information); - managerPart.append(element); + appendNode(element, parentNode); } -export function addTableElement(headers, tbodyName) { +export function addTableElement(headers, tbodyName, parentNode) { const element = document.createElement("table"); element.setAttribute("border", 1); headers.forEach(header => { addElement("th", header, null, null, element); }) addElement("tbody", null, "id", tbodyName, element); - managerPart.append(element); + appendNode(element, parentNode); } -export function addSelectElement(idName) { +export function addSelectElement(name, parentNode) { const stationList = getItemList(words.STATIONS); const element = document.createElement("select"); - element.setAttribute("id", idName); + element.setAttribute("id", name); if(stationList !== null) { stationList.forEach(station => { const option = document.createElement("option"); @@ -49,18 +53,18 @@ export function addSelectElement(idName) { element.append(option); }); } - managerPart.append(element); + appendNode(element, parentNode); } -export function addClickEventInDeleteButton(buttonName, event, isNew) { - const deleteButtons = document.querySelectorAll(`.${buttonName}`); +export function addClickEventInButtons(buttonName, event, isNew) { + const buttons = document.querySelectorAll(`.${buttonName}`); if(isNew) { - const length = deleteButtons.length; - addClickEventListener(deleteButtons[length - 1], () => {event(deleteButtons[length-1])}); + const length = buttons.length; + addClickEventListener(buttons[length - 1], () => {event(buttons[length-1])}); } else { - deleteButtons.forEach(deleteButton => { - addClickEventListener(deleteButton, () => {event(deleteButton)}); + buttons.forEach(button => { + addClickEventListener(button, () => {event(button)}); }) } } diff --git a/src/common/words.js b/src/common/words.js index bdfd33f27..f53f88059 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -28,9 +28,25 @@ const words = { LINE_DELETE_BUTTON: "line-delete-button", LINE_TABLE_TBODY: "line-table-tbody", + SECTION_LINE_SELECT_TEXT: "ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.", + SECTION_DELETE_TEXT: "λ…Έμ„ μ—μ„œ 제거", + SECTION_ADD_TEXT: "ꡬ간 등둝", + SECTION_LINE_MENU_BUTTON: "section-line-menu-button", + SECTION_MANAGEMENT_PART: "section-management-part", + SECTION_STATION_SELECTOR: "section-station-selector", + SECTION_ORDER_INPUT: "section-order-input", + SECTION_ADD_BUTTON: "section-add-button", + SECTION_ADD_TEXT_ID: "section-add-text", + SECTION_DELETE_BUTTON: "section-delete-button", + SECTION_TABLE_TBODY: "section-table-tbody", + DELETE: "μ‚­μ œ", DELETE_ALERT: "μ •λ§λ‘œ μ‚­μ œν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?", SETTING: "μ„€μ •", + MANAGEMENT: "관리", + ENROLLMENT: "등둝", + NAME: "이름", + ORDER: "μˆœμ„œ" } export default words; \ No newline at end of file diff --git a/src/index.js b/src/index.js index fb66ac782..00ae36cd9 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ import {addClickEventListener} from './common/elements.js' import StationManager from './station-manager.js'; import LineManager from './line-manager.js'; -// import SectionManager from './section-manager.js'; +import SectionManager from './section-manager.js'; // import MapPringManager from './map-print-manager.js'; export default function stationPageInit() { @@ -11,7 +11,7 @@ export default function stationPageInit() { const mapPrintManagerButton = document.getElementById('map-print-manager-button'); addClickEventListener(stationManagerButton, () => {new StationManager()}); addClickEventListener(lineManagerButton, () => {new LineManager()}); - // addClickEventListener(lineManagerButton, () => {new LineManager()}); + addClickEventListener(sectionManagerButton, () => {new SectionManager()}); } new stationPageInit(); diff --git a/src/line-manager.js b/src/line-manager.js index 8a0da11ac..b8424c0f2 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -5,7 +5,7 @@ import { addSelectElement, addClickEventListener, pageInit, - addClickEventInDeleteButton + addClickEventInButtons } from "./common/elements.js"; import { isEmpty, @@ -28,16 +28,16 @@ export default class LineManager { setPage() { pageInit(); addElement("h4", words.LINE_NAME, null, null, null); - addInputElement(words.LINE_NAME_INPUT, words.LINE_INPUT_ALERT); + addInputElement(words.LINE_NAME_INPUT, words.LINE_INPUT_ALERT, null); addElement("h4", words.LINE_START_STATION, "class", words.LINE_STATION_TEXT, null); - addSelectElement(words.LINE_START_STATION_SELECTOR); + addSelectElement(words.LINE_START_STATION_SELECTOR, null); addElement("br", null, null, null, null); addElement("h4", words.LINE_END_STATION, "class", words.LINE_STATION_TEXT, null); - addSelectElement(words.LINE_END_STATION_SELECTOR); + addSelectElement(words.LINE_END_STATION_SELECTOR, null); addElement("p", null, null, null, null); addElement("button", words.LINE_ADD, "id",words.LINE_ADD_BUTTON, null); addElement("h2", words.LINE_LIST, null, null, null); - addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY); + addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY, null); } deleteLine(deleteButton) { @@ -59,7 +59,7 @@ export default class LineManager { } addTableRow(lineName, lineStartStationName, lineEndStationName) { - const row = this.lineTableTbody.insertRow(this.lineTableTbody.length); + const row = this.lineTableTbody.insertRow(); row.setAttribute("data-line-name", lineName); const cell1 = row.insertCell(0); const cell2 = row.insertCell(1); @@ -78,7 +78,7 @@ export default class LineManager { const lineSectionList = getItemList(line); this.addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); }); - addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), false); + addClickEventInButtons(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), false); } } @@ -89,10 +89,10 @@ export default class LineManager { addLineInTable(lineInputName, lineStartStationName, lineEndStationName) {this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); - addClickEventInDeleteButton(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); + addClickEventInButtons(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } - getAlertText(lineInputName) { + getAlertText(lineInputName, lineStartStationName, lineEndStationName) { let text = ""; if(!isEmpty(lineInputName)) { text = words.LINE_INPUT_ALERT; @@ -113,7 +113,7 @@ export default class LineManager { addLine() { const lineInputName = removeWhiteSpaceValue(document.getElementById(words.LINE_NAME_INPUT).value); - const lineStationName = getLineStationName(); + const lineStationName = this.getLineStationName(); const alertText = this.getAlertText(lineInputName, lineStationName[0], lineStationName[1]); if(alertText === "") { if(addItem(words.LINES, lineInputName)) { diff --git a/src/section-manager.js b/src/section-manager.js new file mode 100644 index 000000000..1de48368c --- /dev/null +++ b/src/section-manager.js @@ -0,0 +1,88 @@ +import { + addElement, + addInputElement, + addTableElement, + addSelectElement, + addClickEventListener, + pageInit, + addClickEventInButtons +} from "./common/elements.js"; +import { + isEmpty, + addItem, + getItemList, + removeWhiteSpaceValue, + deleteKey, + deleteItem +} from "./common/items.js"; +import words from "./common/words.js"; + +export default class SectionManager { + constructor() { + this.setPage(); + this.setSectionLineMenuButton(); + // addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection()}); + } + + setPage() { + pageInit(); + addElement("h3", words.SECTION_LINE_SELECT_TEXT, null, null, null); + } + + confirmDeleteSection(deleteButton) { + const isConfirm = confirm(words.DELETE_ALERT); + if(isConfirm) { + // this.deleteLine(deleteButton); + console.log(deleteButton); + } + } + + addTableRow(section, sectionTableTbody) { + const index = sectionTableTbody.length; + const row = sectionTableTbody.insertRow(); + row.setAttribute("data-section-name", section); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + cell1.innerHTML = sectionTableTbody.childElementCount - 1; + cell2.innerHTML = section; + addElement("button", words.SECTION_DELETE_TEXT, "class", words.SECTION_DELETE_BUTTON, cell3); + } + + setTableContent(lineName) { + const sectionTableTbody = document.getElementById(words.SECTION_TABLE_TBODY); + const sectionList = getItemList(lineName); + sectionTableTbody.innerHTML = ""; + if(sectionList !== null) { + sectionList.forEach(section => { + this.addTableRow(section, sectionTableTbody); + }); + addClickEventInButtons(words.SECTION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), false); + } + } + + setSectionLineElement(menuButton) { + const sectionManagementPart = document.getElementById(words.SECTION_MANAGEMENT_PART); + const lineName = menuButton.innerText; + sectionManagementPart.innerHTML = ""; + addElement("h3", `${lineName} ${words.MANAGEMENT}`, null, null, sectionManagementPart); + addElement("h4", words.SECTION_ADD_TEXT, "id", words.SECTION_ADD_TEXT_ID, sectionManagementPart); + addSelectElement(words.SECTION_STATION_SELECTOR, sectionManagementPart); + addInputElement(words.SECTION_ORDER_INPUT, words.ORDER, sectionManagementPart); + addElement("button", words.ENROLLMENT, "id", words.SECTION_ADD_BUTTON, sectionManagementPart); + addElement("p", null, null, null, sectionManagementPart); + addTableElement([words.ORDER, words.NAME, words.SETTING], words.SECTION_TABLE_TBODY, sectionManagementPart); + this.setTableContent(lineName); + } + + setSectionLineMenuButton() { + const lineList = getItemList(words.LINES); + if(lineList !== null) { + lineList.forEach(line => { + addElement("button", line, "class", words.SECTION_LINE_MENU_BUTTON, null); + }); + addClickEventInButtons(words.SECTION_LINE_MENU_BUTTON, this.setSectionLineElement.bind(this), false); + } + addElement("div", null, "id", words.SECTION_MANAGEMENT_PART, null); + } +} \ No newline at end of file diff --git a/src/station-manager.js b/src/station-manager.js index f8818ee47..fbb6eac4c 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -4,7 +4,7 @@ import { addTableElement, addClickEventListener, pageInit, - addClickEventInDeleteButton + addClickEventInButtons } from "./common/elements.js"; import { isEmpty, @@ -25,10 +25,10 @@ export default class StationManager{ setPage() { pageInit(); addElement("h4", words.STATION_NAME, null, null, null); - addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT); + addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT, null); addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); addElement("h2", words.STATION_LIST, null, null, null); - addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY); + addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY, null); } // μˆ˜μ •ν•΄μ•Όν•¨ @@ -37,7 +37,7 @@ export default class StationManager{ } addTableRow(station) { - const row = this.stationTableTbody.insertRow(this.stationTableTbody.length); + const row = this.stationTableTbody.insertRow(); const cell1 = row.insertCell(0); const cell2 = row.insertCell(1); cell1.innerHTML = station; @@ -50,13 +50,13 @@ export default class StationManager{ stationList.forEach(station => { this.addTableRow(station); }); - addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.deleteStation); } } addStationInTable(station) { this.addTableRow(station); - addClickEventInDeleteButton(words.STATION_DELETE_BUTTON, this.deleteStation); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.deleteStation); } getAlertText(stationInputName) { diff --git a/src/style.css b/src/style.css index abdc6417b..463208760 100644 --- a/src/style.css +++ b/src/style.css @@ -1,15 +1,12 @@ h4 { margin-bottom: 0px; + margin-right: 5px; } input { margin-right: 5px; } -select { - margin-left: 5px; -} - #line-name-input { margin-bottom: 20px; display: block; @@ -19,6 +16,19 @@ select { display: inline; } +.section-line-menu-button { + margin-right: 5px; +} + +#section-order-input { + margin-left: 5px; + margin-bottom: 30px; +} + +#section-add-text { + margin-bottom: 20px; +} + From 600357c9a0917c5b547bd07aa117f7a190e4a494 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 01:11:31 +0900 Subject: [PATCH 15/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EC=A7=80=ED=95=98?= =?UTF-8?q?=EC=B2=A0=20=EA=B5=AC=EA=B0=84=20=EA=B4=80=EB=A0=A8=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=EC=9D=98=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1a08d12e9..db5c2d541 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ - λ…Έμ„ λ‚΄μ˜ μ—­μ˜ κ°œμˆ˜κ°€ 2개λ₯Ό μ΄ˆκ³Όν•˜λŠ”μ§€ 확인해야 ν•œλ‹€. - 상행쒅점역을 μ œκ±°ν–ˆμ„ 경우 λ‹€μŒμ—­μ΄ 상행쒅점역이 λ˜λ„λ‘ ν•œλ‹€. - ν•˜ν–‰μ’…μ μ—­μ„ μ œκ±°ν–ˆμ„ 경우 이전역이 ν•˜ν–‰μ’…μ μ—­μ΄ λ˜λ„λ‘ ν•œλ‹€. +- 노선에 λ“±λ‘λœ μ—­μ˜ λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. ### μ§€ν•˜μ²  전체 λ…Έμ„  쑰회 κΈ°λŠ₯ - λͺ¨λ“  μ§€ν•˜μ²  λ…Έμ„ μ˜ μ—­ λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. ### 곡톡 κΈ°λŠ₯ From a9fbf1d93908d4a1c6c29fc60005c31bc381f9ae Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 01:51:35 +0900 Subject: [PATCH 16/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EC=97=AD=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 4 ++-- src/common/words.js | 1 + src/station-manager.js | 42 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/common/items.js b/src/common/items.js index 73c9d7e8c..195255737 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -11,7 +11,7 @@ export function isEmpty(value) { return result; } -export function isItemDuplicate(itemList, value) { +export function isDuplicateItem(itemList, value) { let isDuplicate = false; if(itemList.includes(value)) { isDuplicate = true; @@ -30,7 +30,7 @@ export function addItem(key, value) { if(itemList === null){ itemList = []; } - if(!isItemDuplicate(itemList, value)){ + if(!isDuplicateItem(itemList, value)){ itemList.push(value); localStorage.setItem(key, JSON.stringify(itemList)); isComplete = true; diff --git a/src/common/words.js b/src/common/words.js index f53f88059..b2138afe0 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -6,6 +6,7 @@ const words = { STATION_INPUT_ALERT: "μ—­ 이름을 μž…λ ₯ν•΄μ£Όμ„Έμš”.", STATION_LENGTH_ALERT: "μ—­ 이름을 2κΈ€μž 이상 μž‘μ„±ν•΄μ£Όμ„Έμš”.", STATION_DUPLICATE_ALERT: "역은 이미 λ“±λ‘λœ μ—­μž…λ‹ˆλ‹€.", + STATION_IN_LINE_ALERT: "역은 이미 노선에 λ“±λ‘λ˜μ–΄ μžˆμ–΄ μ‚­μ œκ°€ λΆˆκ°€λŠ₯ν•©λ‹ˆλ‹€.", STATION_NAME_INPUT: "station-name-input", STATION_ADD_BUTTON: "station-add-button", STATION_DELETE_BUTTON: "station-delete-button", diff --git a/src/station-manager.js b/src/station-manager.js index fbb6eac4c..ae2dd0c75 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -10,7 +10,9 @@ import { isEmpty, addItem, getItemList, - removeWhiteSpaceValue} + removeWhiteSpaceValue, + deleteItem, + deleteKey} from "./common/items.js"; import words from "./common/words.js"; @@ -30,14 +32,42 @@ export default class StationManager{ addElement("h2", words.STATION_LIST, null, null, null); addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY, null); } + + deleteStation(stationName, deleteRow) { + this.stationTableTbody.removeChild(deleteRow); + deleteItem(words.STATIONS, stationName); + if(this.stationTableTbody.childElementCount === 0) { + deleteKey(words.STATIONS); + } + } + + isStationInLine(stationName) { + const lineList = getItemList(words.LINES); + let result = false; + lineList.forEach(line => { + const lineSectionList = getItemList(line); + result = lineSectionList.includes(stationName) ? true : result; + }) + return result; + } - // μˆ˜μ •ν•΄μ•Όν•¨ - deleteStation() { - alert("delete"); + confirmDeleteSection(deleteButton) { + const isConfirm = confirm(words.DELETE_ALERT); + const deleteRow = deleteButton.parentElement.parentElement; + const stationName = deleteRow.dataset.stationName; + if(isConfirm) { + if(this.isStationInLine(stationName)) { + alert(`${stationName}${words.STATION_IN_LINE_ALERT}`); + } + else { + this.deleteStation(stationName, deleteRow); + } + } } addTableRow(station) { const row = this.stationTableTbody.insertRow(); + row.setAttribute("data-station-name", station); const cell1 = row.insertCell(0); const cell2 = row.insertCell(1); cell1.innerHTML = station; @@ -50,13 +80,13 @@ export default class StationManager{ stationList.forEach(station => { this.addTableRow(station); }); - addClickEventInButtons(words.STATION_DELETE_BUTTON, this.deleteStation); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), false); } } addStationInTable(station) { this.addTableRow(station); - addClickEventInButtons(words.STATION_DELETE_BUTTON, this.deleteStation); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), true); } getAlertText(stationInputName) { From 8f8d8909fba6229a9a39d1ee66d0fda5c3ba1d7a Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 03:30:47 +0900 Subject: [PATCH 17/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EB=85=B8=EC=84=A0=EC=97=90=20?= =?UTF-8?q?=EA=B5=AC=EA=B0=84=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 8 ++++---- src/common/words.js | 3 +++ src/line-manager.js | 4 ++-- src/section-manager.js | 42 ++++++++++++++++++++++++++++++++++++++---- src/station-manager.js | 4 ++-- 5 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/common/items.js b/src/common/items.js index 195255737..177415919 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -3,10 +3,10 @@ export function removeWhiteSpaceValue(value) { } export function isEmpty(value) { - let result = true; + let result = false; if(value === "" || value === null || value === undefined || (value !== null && typeof value === "object" && !Object.keys(value).length)) { - result = false; + result = true; } return result; } @@ -23,7 +23,7 @@ export function getItemList(key) { return JSON.parse(localStorage.getItem(key)); } -export function addItem(key, value) { +export function addItem(key, value, index) { let itemList = getItemList(key); let isComplete = false; // μˆ˜μ • - 더 효율적으둜 μˆ˜μ •ν•˜κΈ° @@ -31,7 +31,7 @@ export function addItem(key, value) { itemList = []; } if(!isDuplicateItem(itemList, value)){ - itemList.push(value); + itemList.splice(index, 0, value); localStorage.setItem(key, JSON.stringify(itemList)); isComplete = true; } diff --git a/src/common/words.js b/src/common/words.js index b2138afe0..bfd5669b0 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -32,6 +32,9 @@ const words = { SECTION_LINE_SELECT_TEXT: "ꡬ간을 μˆ˜μ •ν•  노선을 μ„ νƒν•΄μ£Όμ„Έμš”.", SECTION_DELETE_TEXT: "λ…Έμ„ μ—μ„œ 제거", SECTION_ADD_TEXT: "ꡬ간 등둝", + SECTION_STATION_DUPLICATE_ALERT: "역은 이미 ν•΄λ‹Ή 노선에 λ“±λ‘λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.", + SECTION_STATION_ORDER_INPUT_ALERT: "μˆœμ„œλ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”", + SECTION_STATION_ORDER_CORRECT_ALERT: "μ‚¬μ΄μ˜ 숫자λ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”", SECTION_LINE_MENU_BUTTON: "section-line-menu-button", SECTION_MANAGEMENT_PART: "section-management-part", SECTION_STATION_SELECTOR: "section-station-selector", diff --git a/src/line-manager.js b/src/line-manager.js index b8424c0f2..d2cb587e6 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -94,7 +94,7 @@ export default class LineManager { getAlertText(lineInputName, lineStartStationName, lineEndStationName) { let text = ""; - if(!isEmpty(lineInputName)) { + if(isEmpty(lineInputName)) { text = words.LINE_INPUT_ALERT; } else if(lineStartStationName === lineEndStationName) { @@ -116,7 +116,7 @@ export default class LineManager { const lineStationName = this.getLineStationName(); const alertText = this.getAlertText(lineInputName, lineStationName[0], lineStationName[1]); if(alertText === "") { - if(addItem(words.LINES, lineInputName)) { + if(addItem(words.LINES, lineInputName, -1)) { this.addLineInTable(lineInputName, lineStationName[0], lineStationName[1]); } else { diff --git a/src/section-manager.js b/src/section-manager.js index 1de48368c..3761b52fe 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -13,7 +13,8 @@ import { getItemList, removeWhiteSpaceValue, deleteKey, - deleteItem + deleteItem, + isDuplicateItem } from "./common/items.js"; import words from "./common/words.js"; @@ -21,8 +22,7 @@ export default class SectionManager { constructor() { this.setPage(); this.setSectionLineMenuButton(); - // addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection()}); - } + } setPage() { pageInit(); @@ -38,7 +38,6 @@ export default class SectionManager { } addTableRow(section, sectionTableTbody) { - const index = sectionTableTbody.length; const row = sectionTableTbody.insertRow(); row.setAttribute("data-section-name", section); const cell1 = row.insertCell(0); @@ -61,6 +60,40 @@ export default class SectionManager { } } + getAlertText(order) { + const tableRowCount = document.getElementById(words.SECTION_TABLE_TBODY).childElementCount; + let text = ""; + if(isEmpty(order)) { + text = words.SECTION_STATION_ORDER_INPUT_ALERT; + } + else if(order < 0 || order > tableRowCount) { + text = `0~${tableRowCount} ${words.SECTION_STATION_ORDER_CORRECT_ALERT}`; + } + return text; + } + + addSectionInLine(lineName, sectionStationName, order) { + const alertText = this.getAlertText(order); + if(alertText === "") { + if(addItem(lineName, sectionStationName, order)) { + this.setTableContent(lineName); + } + else { + alert(`${sectionStationName}${words.SECTION_STATION_DUPLICATE_ALERT}`); + } + } + else { + alert(alertText); + } + } + + addSection(lineName) { + const order = removeWhiteSpaceValue(document.getElementById(words.SECTION_ORDER_INPUT).value); + const sectionStationSelector = document.getElementById(words.SECTION_STATION_SELECTOR); + const sectionStationName = sectionStationSelector.options[sectionStationSelector.selectedIndex].value; + this.addSectionInLine(lineName, sectionStationName, order); + } + setSectionLineElement(menuButton) { const sectionManagementPart = document.getElementById(words.SECTION_MANAGEMENT_PART); const lineName = menuButton.innerText; @@ -72,6 +105,7 @@ export default class SectionManager { addElement("button", words.ENROLLMENT, "id", words.SECTION_ADD_BUTTON, sectionManagementPart); addElement("p", null, null, null, sectionManagementPart); addTableElement([words.ORDER, words.NAME, words.SETTING], words.SECTION_TABLE_TBODY, sectionManagementPart); + addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection(lineName)}); this.setTableContent(lineName); } diff --git a/src/station-manager.js b/src/station-manager.js index ae2dd0c75..9c20a662a 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -91,7 +91,7 @@ export default class StationManager{ getAlertText(stationInputName) { let text = ""; - if(!isEmpty(stationInputName)) { + if(isEmpty(stationInputName)) { text = words.STATION_INPUT_ALERT; } else if(stationInputName.length < 2) { @@ -104,7 +104,7 @@ export default class StationManager{ const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); const alertText = this.getAlertText(stationInputName); if(alertText === "") { - if(addItem(words.STATIONS, stationInputName)) { + if(addItem(words.STATIONS, stationInputName, -1)) { this.addStationInTable(stationInputName); } else { From 9069943aa1862fb927e88239093b4c56c6753c58 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 04:32:21 +0900 Subject: [PATCH 18/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EB=85=B8=EC=84=A0=EC=97=90=20=EB=93=B1=EB=A1=9D=EB=90=9C=20?= =?UTF-8?q?=EC=97=AD=20=EC=A0=9C=EA=B1=B0=ED=95=98=EB=8A=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/words.js | 1 + src/index.js | 5 ++-- src/section-manager.js | 66 +++++++++++++++++++++++++----------------- src/station-manager.js | 6 ++-- 4 files changed, 46 insertions(+), 32 deletions(-) diff --git a/src/common/words.js b/src/common/words.js index bfd5669b0..401621b15 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -35,6 +35,7 @@ const words = { SECTION_STATION_DUPLICATE_ALERT: "역은 이미 ν•΄λ‹Ή 노선에 λ“±λ‘λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€.", SECTION_STATION_ORDER_INPUT_ALERT: "μˆœμ„œλ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”", SECTION_STATION_ORDER_CORRECT_ALERT: "μ‚¬μ΄μ˜ 숫자λ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”", + SECTION_STATION_NO_DELETE_ALERT: "λ…Έμ„ μ—λŠ” μ΅œμ†Œ 2개 μ΄μƒμ˜ 역이 λ“±λ‘λ˜μ–΄ μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.", SECTION_LINE_MENU_BUTTON: "section-line-menu-button", SECTION_MANAGEMENT_PART: "section-management-part", SECTION_STATION_SELECTOR: "section-station-selector", diff --git a/src/index.js b/src/index.js index 00ae36cd9..7d7fb0418 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,8 @@ import {addClickEventListener} from './common/elements.js' -import StationManager from './station-manager.js'; +import StationManager from './station-manager.js; import LineManager from './line-manager.js'; import SectionManager from './section-manager.js'; -// import MapPringManager from './map-print-manager.js'; +// import MapPrintManager from './map-print-manager.js'; export default function stationPageInit() { const stationManagerButton = document.getElementById('station-manager-button'); @@ -12,6 +12,7 @@ export default function stationPageInit() { addClickEventListener(stationManagerButton, () => {new StationManager()}); addClickEventListener(lineManagerButton, () => {new LineManager()}); addClickEventListener(sectionManagerButton, () => {new SectionManager()}); + // addClickEventListener(mapPrintManagerButton, () => {new MapPrintManager()}); } new stationPageInit(); diff --git a/src/section-manager.js b/src/section-manager.js index 3761b52fe..44063aec8 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -12,7 +12,6 @@ import { addItem, getItemList, removeWhiteSpaceValue, - deleteKey, deleteItem, isDuplicateItem } from "./common/items.js"; @@ -20,6 +19,8 @@ import words from "./common/words.js"; export default class SectionManager { constructor() { + this.sectionTableTbody; + this.lineName; this.setPage(); this.setSectionLineMenuButton(); } @@ -29,39 +30,49 @@ export default class SectionManager { addElement("h3", words.SECTION_LINE_SELECT_TEXT, null, null, null); } - confirmDeleteSection(deleteButton) { - const isConfirm = confirm(words.DELETE_ALERT); - if(isConfirm) { - // this.deleteLine(deleteButton); - console.log(deleteButton); - } - } - - addTableRow(section, sectionTableTbody) { - const row = sectionTableTbody.insertRow(); + addTableRow(section) { + const row = this.sectionTableTbody.insertRow(); row.setAttribute("data-section-name", section); const cell1 = row.insertCell(0); const cell2 = row.insertCell(1); const cell3 = row.insertCell(2); - cell1.innerHTML = sectionTableTbody.childElementCount - 1; + cell1.innerHTML = this.sectionTableTbody.childElementCount - 1; cell2.innerHTML = section; addElement("button", words.SECTION_DELETE_TEXT, "class", words.SECTION_DELETE_BUTTON, cell3); } - setTableContent(lineName) { - const sectionTableTbody = document.getElementById(words.SECTION_TABLE_TBODY); - const sectionList = getItemList(lineName); - sectionTableTbody.innerHTML = ""; + setTableContent() { + const sectionList = getItemList(this.lineName); + this.sectionTableTbody.innerHTML = ""; if(sectionList !== null) { sectionList.forEach(section => { - this.addTableRow(section, sectionTableTbody); + this.addTableRow(section); }); addClickEventInButtons(words.SECTION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), false); } } + deleteSection(deleteButton) { + const deleteRow = deleteButton.parentElement.parentElement; + deleteItem(this.lineName, deleteRow.dataset.sectionName); + this.sectionTableTbody.removeChild(deleteRow); + this.setTableContent(); + } + + confirmDeleteSection(deleteButton) { + const isConfirm = confirm(words.DELETE_ALERT); + if(isConfirm) { + if(this.sectionTableTbody.childElementCount <= 2) { + alert(words.SECTION_STATION_NO_DELETE_ALERT); + } + else { + this.deleteSection(deleteButton); + } + } + } + getAlertText(order) { - const tableRowCount = document.getElementById(words.SECTION_TABLE_TBODY).childElementCount; + const tableRowCount =this.sectionTableTbody.childElementCount; let text = ""; if(isEmpty(order)) { text = words.SECTION_STATION_ORDER_INPUT_ALERT; @@ -72,11 +83,11 @@ export default class SectionManager { return text; } - addSectionInLine(lineName, sectionStationName, order) { + addSectionInLine(sectionStationName, order) { const alertText = this.getAlertText(order); if(alertText === "") { - if(addItem(lineName, sectionStationName, order)) { - this.setTableContent(lineName); + if(addItem(this.lineName, sectionStationName, order)) { + this.setTableContent(); } else { alert(`${sectionStationName}${words.SECTION_STATION_DUPLICATE_ALERT}`); @@ -87,26 +98,27 @@ export default class SectionManager { } } - addSection(lineName) { + addSection() { const order = removeWhiteSpaceValue(document.getElementById(words.SECTION_ORDER_INPUT).value); const sectionStationSelector = document.getElementById(words.SECTION_STATION_SELECTOR); const sectionStationName = sectionStationSelector.options[sectionStationSelector.selectedIndex].value; - this.addSectionInLine(lineName, sectionStationName, order); + this.addSectionInLine(sectionStationName, order); } setSectionLineElement(menuButton) { const sectionManagementPart = document.getElementById(words.SECTION_MANAGEMENT_PART); - const lineName = menuButton.innerText; + this.lineName = menuButton.innerText; sectionManagementPart.innerHTML = ""; - addElement("h3", `${lineName} ${words.MANAGEMENT}`, null, null, sectionManagementPart); + addElement("h3", `${this.lineName} ${words.MANAGEMENT}`, null, null, sectionManagementPart); addElement("h4", words.SECTION_ADD_TEXT, "id", words.SECTION_ADD_TEXT_ID, sectionManagementPart); addSelectElement(words.SECTION_STATION_SELECTOR, sectionManagementPart); addInputElement(words.SECTION_ORDER_INPUT, words.ORDER, sectionManagementPart); addElement("button", words.ENROLLMENT, "id", words.SECTION_ADD_BUTTON, sectionManagementPart); addElement("p", null, null, null, sectionManagementPart); addTableElement([words.ORDER, words.NAME, words.SETTING], words.SECTION_TABLE_TBODY, sectionManagementPart); - addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection(lineName)}); - this.setTableContent(lineName); + addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection()}); + this.sectionTableTbody = document.querySelector(`#${words.SECTION_TABLE_TBODY}`); + this.setTableContent(); } setSectionLineMenuButton() { diff --git a/src/station-manager.js b/src/station-manager.js index 9c20a662a..d1d054b4f 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -51,7 +51,7 @@ export default class StationManager{ return result; } - confirmDeleteSection(deleteButton) { + confirmDeleteStation(deleteButton) { const isConfirm = confirm(words.DELETE_ALERT); const deleteRow = deleteButton.parentElement.parentElement; const stationName = deleteRow.dataset.stationName; @@ -80,13 +80,13 @@ export default class StationManager{ stationList.forEach(station => { this.addTableRow(station); }); - addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), false); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteStation.bind(this), false); } } addStationInTable(station) { this.addTableRow(station); - addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), true); + addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteStation.bind(this), true); } getAlertText(stationInputName) { From 82f96d9f8a27d9bb75cea91f6bc5ce5cfbc8a467 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 05:12:22 +0900 Subject: [PATCH 19/25] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80:=20?= =?UTF-8?q?=EC=A7=80=ED=95=98=EC=B2=A0=20=EC=A0=84=EC=B2=B4=20=EB=85=B8?= =?UTF-8?q?=EC=84=A0=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/words.js | 3 ++- src/index.js | 8 ++++---- src/map-print-manager.js | 29 +++++++++++++++++++++++++++++ src/style.css | 10 +++++++--- 4 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 src/map-print-manager.js diff --git a/src/common/words.js b/src/common/words.js index 401621b15..b2e381137 100644 --- a/src/common/words.js +++ b/src/common/words.js @@ -51,7 +51,8 @@ const words = { MANAGEMENT: "관리", ENROLLMENT: "등둝", NAME: "이름", - ORDER: "μˆœμ„œ" + ORDER: "μˆœμ„œ", + MAP: "map" } export default words; \ No newline at end of file diff --git a/src/index.js b/src/index.js index 7d7fb0418..678b60d2a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,8 @@ -import {addClickEventListener} from './common/elements.js' -import StationManager from './station-manager.js; +import {addClickEventListener} from './common/elements.js'; +import StationManager from './station-manager.js'; import LineManager from './line-manager.js'; import SectionManager from './section-manager.js'; -// import MapPrintManager from './map-print-manager.js'; +import MapPrintManager from './map-print-manager.js'; export default function stationPageInit() { const stationManagerButton = document.getElementById('station-manager-button'); @@ -12,7 +12,7 @@ export default function stationPageInit() { addClickEventListener(stationManagerButton, () => {new StationManager()}); addClickEventListener(lineManagerButton, () => {new LineManager()}); addClickEventListener(sectionManagerButton, () => {new SectionManager()}); - // addClickEventListener(mapPrintManagerButton, () => {new MapPrintManager()}); + addClickEventListener(mapPrintManagerButton, () => {new MapPrintManager()}); } new stationPageInit(); diff --git a/src/map-print-manager.js b/src/map-print-manager.js new file mode 100644 index 000000000..515a22b39 --- /dev/null +++ b/src/map-print-manager.js @@ -0,0 +1,29 @@ +import {addElement, pageInit} from "./common/elements.js"; +import {getItemList} from "./common/items.js"; +import words from "./common/words.js"; + +export default class MapPrintManager { + constructor() { + pageInit(); + addElement("div", null, "class", words.MAP, null); + this.map = document.querySelector(`.${words.MAP}`); + this.printMap(); + } + + setMapContent(line) { + const sectionList = getItemList(line); + sectionList.forEach(section => { + addElement("li", section, null, null, this.map); + }) + } + + printMap() { + const lineList = getItemList(words.LINES); + if(lineList !== null) { + lineList.forEach(line => { + addElement("h3", line, null, null, this.map); + this.setMapContent(line); + }); + } + } +} \ No newline at end of file diff --git a/src/style.css b/src/style.css index 463208760..6962c5c98 100644 --- a/src/style.css +++ b/src/style.css @@ -7,9 +7,8 @@ input { margin-right: 5px; } -#line-name-input { - margin-bottom: 20px; - display: block; +li { + margin-left: 30px; } .line-station-text { @@ -29,6 +28,11 @@ input { margin-bottom: 20px; } +#line-name-input { + margin-bottom: 20px; + display: block; +} + From 899dcce1d69803a28c27d98f184652e4944e09d3 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 05:15:33 +0900 Subject: [PATCH 20/25] =?UTF-8?q?=EB=AC=B8=EC=84=9C:=20=EC=A7=80=ED=95=98?= =?UTF-8?q?=EC=B2=A0=20=EB=85=B8=EC=84=A0=20=EB=93=B1=EB=A1=9D=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + src/line-manager.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db5c2d541..6d60ed08f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - μ§€ν•˜μ²  노선을 λ“±λ‘ν•œλ‹€. - λ…Έμ„ μ˜ 쀑볡 μ—¬λΆ€λ₯Ό 확인해야 ν•œλ‹€. - 상행쒅점역과 ν•˜ν–‰μ’…μ μ—­μ€ μ§€ν•˜μ²  μ—­ λͺ©λ‘μ˜ 첫번째 값이 기본값이닀. + - 상행쒅점역과 ν•˜ν–‰μ’…μ μ—­μ€ μ„œλ‘œ 달라야 ν•œλ‹€. - μ§€ν•˜μ²  노선을 μ‚­μ œν•œλ‹€. - μ§€ν•˜μ²  λ…Έμ„  λͺ©λ‘μ„ μ‘°νšŒν•œλ‹€. - λ…Έμ„  이름, 상행 쒅점역, ν•˜ν–‰ 쒅점역을 μ‘°νšŒν•΄μ•Ό ν•œλ‹€. diff --git a/src/line-manager.js b/src/line-manager.js index d2cb587e6..81703925e 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -87,7 +87,8 @@ export default class LineManager { localStorage.setItem(lineInputName, JSON.stringify(itemList)); } - addLineInTable(lineInputName, lineStartStationName, lineEndStationName) {this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); + addLineInTable(lineInputName, lineStartStationName, lineEndStationName) { + this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); addClickEventInButtons(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } From 961a085d7c5d30fdfe8a0b4b4c4701d4ee72d2bf Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 16:18:23 +0900 Subject: [PATCH 21/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EC=97=AD=EA=B3=BC=20=EB=85=B8=EC=84=A0=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=EC=8B=9C=20=EB=B0=B0=EC=97=B4=EC=9D=98=20=EB=A7=88=EC=A7=80?= =?UTF-8?q?=EB=A7=89=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=EC=95=9E=EC=97=90=20?= =?UTF-8?q?=EC=82=BD=EC=9E=85=EB=90=98=EB=8D=98=20=ED=98=84=EC=83=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/items.js b/src/common/items.js index 177415919..84192b9fe 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -31,6 +31,7 @@ export function addItem(key, value, index) { itemList = []; } if(!isDuplicateItem(itemList, value)){ + index = index === -1 ? itemList.length : index; itemList.splice(index, 0, value); localStorage.setItem(key, JSON.stringify(itemList)); isComplete = true; From 687da026becbdad5584920587c4668ac1d765e39 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 17:11:09 +0900 Subject: [PATCH 22/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20b?= =?UTF-8?q?oolean=20=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=93=A4=20=EA=B0=84=EA=B2=B0=ED=95=98=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 14 +++----------- src/section-manager.js | 3 +-- src/station-manager.js | 15 +++++++++------ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/common/items.js b/src/common/items.js index 84192b9fe..0b45d9e8a 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -3,20 +3,12 @@ export function removeWhiteSpaceValue(value) { } export function isEmpty(value) { - let result = false; - if(value === "" || value === null || value === undefined || (value !== null - && typeof value === "object" && !Object.keys(value).length)) { - result = true; - } - return result; + return (value === "" || value === null || value === undefined || (value !== null + && typeof value === "object" && !Object.keys(value).length)); } export function isDuplicateItem(itemList, value) { - let isDuplicate = false; - if(itemList.includes(value)) { - isDuplicate = true; - } - return isDuplicate; + return itemList.includes(value); } export function getItemList(key) { diff --git a/src/section-manager.js b/src/section-manager.js index 44063aec8..5c7636666 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -12,8 +12,7 @@ import { addItem, getItemList, removeWhiteSpaceValue, - deleteItem, - isDuplicateItem + deleteItem } from "./common/items.js"; import words from "./common/words.js"; diff --git a/src/station-manager.js b/src/station-manager.js index d1d054b4f..b8f4b1fce 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -8,12 +8,13 @@ import { } from "./common/elements.js"; import { isEmpty, + isDuplicateItem, addItem, getItemList, removeWhiteSpaceValue, deleteItem, - deleteKey} -from "./common/items.js"; + deleteKey, +} from "./common/items.js"; import words from "./common/words.js"; export default class StationManager{ @@ -44,10 +45,12 @@ export default class StationManager{ isStationInLine(stationName) { const lineList = getItemList(words.LINES); let result = false; - lineList.forEach(line => { - const lineSectionList = getItemList(line); - result = lineSectionList.includes(stationName) ? true : result; - }) + for(let i = 0; i < lineList.length; i++) { + result = isDuplicateItem(lineList[i], stationName); + if(result) { + break; + } + } return result; } From 63b446b2539b8ea3bc510eeaad2beef3835d58b5 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 17:47:37 +0900 Subject: [PATCH 23/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20g?= =?UTF-8?q?etItemList=ED=95=A8=EC=88=98=EC=97=90=EC=84=9C=20=ED=95=B4?= =?UTF-8?q?=EB=8B=B9=20=ED=82=A4=20=EA=B0=92=EC=97=90=20=EB=8C=80=ED=95=9C?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EA=B0=80=20=EC=A1=B4=EC=9E=AC?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EC=9D=84=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EC=97=90=EB=8A=94=20=EB=B9=88=20=EB=B0=B0=EC=97=B4=EC=9D=84=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20addItem=ED=95=A8=EC=88=98=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B0=84=EA=B2=B0=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/items.js | 11 ++++------- src/line-manager.js | 2 +- src/map-print-manager.js | 10 ++++------ src/section-manager.js | 4 ++-- src/station-manager.js | 2 +- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/common/items.js b/src/common/items.js index 0b45d9e8a..e0a2e96b9 100644 --- a/src/common/items.js +++ b/src/common/items.js @@ -12,17 +12,14 @@ export function isDuplicateItem(itemList, value) { } export function getItemList(key) { - return JSON.parse(localStorage.getItem(key)); + const itemList = JSON.parse(localStorage.getItem(key)); + return itemList === null ? [] : itemList; } export function addItem(key, value, index) { let itemList = getItemList(key); - let isComplete = false; - // μˆ˜μ • - 더 효율적으둜 μˆ˜μ •ν•˜κΈ° - if(itemList === null){ - itemList = []; - } - if(!isDuplicateItem(itemList, value)){ + let isComplete = !isDuplicateItem(itemList, value); + if(isComplete){ index = index === -1 ? itemList.length : index; itemList.splice(index, 0, value); localStorage.setItem(key, JSON.stringify(itemList)); diff --git a/src/line-manager.js b/src/line-manager.js index 81703925e..bf0d0fa49 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -73,7 +73,7 @@ export default class LineManager { setTableContent() { const lineList = getItemList(words.LINES); - if(lineList !== null) { + if(lineList.length > 0) { lineList.forEach(line => { const lineSectionList = getItemList(line); this.addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); diff --git a/src/map-print-manager.js b/src/map-print-manager.js index 515a22b39..f38590f80 100644 --- a/src/map-print-manager.js +++ b/src/map-print-manager.js @@ -19,11 +19,9 @@ export default class MapPrintManager { printMap() { const lineList = getItemList(words.LINES); - if(lineList !== null) { - lineList.forEach(line => { - addElement("h3", line, null, null, this.map); - this.setMapContent(line); - }); - } + lineList.forEach(line => { + addElement("h3", line, null, null, this.map); + this.setMapContent(line); + }); } } \ No newline at end of file diff --git a/src/section-manager.js b/src/section-manager.js index 5c7636666..cbc540538 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -43,7 +43,7 @@ export default class SectionManager { setTableContent() { const sectionList = getItemList(this.lineName); this.sectionTableTbody.innerHTML = ""; - if(sectionList !== null) { + if(sectionList.length > 0) { sectionList.forEach(section => { this.addTableRow(section); }); @@ -122,7 +122,7 @@ export default class SectionManager { setSectionLineMenuButton() { const lineList = getItemList(words.LINES); - if(lineList !== null) { + if(lineList.length > 0) { lineList.forEach(line => { addElement("button", line, "class", words.SECTION_LINE_MENU_BUTTON, null); }); diff --git a/src/station-manager.js b/src/station-manager.js index b8f4b1fce..762a66c8d 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -79,7 +79,7 @@ export default class StationManager{ setTableContent() { const stationList = getItemList(words.STATIONS); - if(stationList !== null) { + if(stationList.length > 0) { stationList.forEach(station => { this.addTableRow(station); }); From 34ab9131e985830ae24a10819d8c0ea43775bb90 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 19:02:17 +0900 Subject: [PATCH 24/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EA=B8=B0=EC=A1=B4=20=ED=95=A8=EC=88=98=EB=93=A4=20=EB=8D=94=20?= =?UTF-8?q?=EC=84=B8=EC=84=B8=ED=95=98=EA=B2=8C=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=8F=20=EB=85=B8=EC=84=A0=EC=97=90=20=EB=93=B1=EB=A1=9D?= =?UTF-8?q?=EB=90=9C=20=EC=97=AD=EC=9D=B4=20=EC=82=AD=EC=A0=9C=EB=90=98?= =?UTF-8?q?=EB=8D=98=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/elements.js | 8 ++++---- src/line-manager.js | 21 ++++++++++----------- src/section-manager.js | 35 +++++++++++++++++----------------- src/station-manager.js | 43 ++++++++++++++++++++++-------------------- 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/src/common/elements.js b/src/common/elements.js index f4e8daa0a..b368085bb 100644 --- a/src/common/elements.js +++ b/src/common/elements.js @@ -3,15 +3,15 @@ import words from "./words.js"; export const managerPart = document.getElementById("manager-part"); -export function addClickEventListener(target, event) { - target.addEventListener("click", event); -} - function appendNode(childNode, parentNode) { parentNode = parentNode === null ? managerPart : parentNode; parentNode.append(childNode); } +export function addClickEventListener(target, event) { + target.addEventListener("click", event); +} + export function addElement(type, content, attribute, attributeName, parentNode) { const element = document.createElement(type); if(content !== null) { diff --git a/src/line-manager.js b/src/line-manager.js index bf0d0fa49..a59abf3c7 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -112,20 +112,19 @@ export default class LineManager { return [lineStartStationName, lineEndStationName]; } + addLineInStorage(lineInputName, lineStationName) { + if(addItem(words.LINES, lineInputName, -1)) { + this.addLineInTable(lineInputName, lineStationName[0], lineStationName[1]); + } + else { + alert(`${lineInputName}${words.LINE_DUPLICATE_ALERT}`); + } + } + addLine() { const lineInputName = removeWhiteSpaceValue(document.getElementById(words.LINE_NAME_INPUT).value); const lineStationName = this.getLineStationName(); const alertText = this.getAlertText(lineInputName, lineStationName[0], lineStationName[1]); - if(alertText === "") { - if(addItem(words.LINES, lineInputName, -1)) { - this.addLineInTable(lineInputName, lineStationName[0], lineStationName[1]); - } - else { - alert(`${lineInputName}${words.LINE_DUPLICATE_ALERT}`); - } - } - else { - alert(alertText); - } + alertText === "" ? this.addLineInStorage(lineInputName, lineStationName) : alert(alertText); } } \ No newline at end of file diff --git a/src/section-manager.js b/src/section-manager.js index cbc540538..2978d5f99 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -51,22 +51,26 @@ export default class SectionManager { } } - deleteSection(deleteButton) { - const deleteRow = deleteButton.parentElement.parentElement; + deleteSection(deleteRow) { deleteItem(this.lineName, deleteRow.dataset.sectionName); this.sectionTableTbody.removeChild(deleteRow); this.setTableContent(); } + decideDeleteSection(deleteButton) { + const deleteRow = deleteButton.parentElement.parentElement; + if(this.sectionTableTbody.childElementCount <= 2) { + alert(words.SECTION_STATION_NO_DELETE_ALERT); + } + else { + this.deleteSection(deleteRow); + } + } + confirmDeleteSection(deleteButton) { const isConfirm = confirm(words.DELETE_ALERT); if(isConfirm) { - if(this.sectionTableTbody.childElementCount <= 2) { - alert(words.SECTION_STATION_NO_DELETE_ALERT); - } - else { - this.deleteSection(deleteButton); - } + this.decideDeleteSection(deleteButton); } } @@ -83,17 +87,11 @@ export default class SectionManager { } addSectionInLine(sectionStationName, order) { - const alertText = this.getAlertText(order); - if(alertText === "") { - if(addItem(this.lineName, sectionStationName, order)) { - this.setTableContent(); - } - else { - alert(`${sectionStationName}${words.SECTION_STATION_DUPLICATE_ALERT}`); - } + if(addItem(this.lineName, sectionStationName, order)) { + this.setTableContent(); } else { - alert(alertText); + alert(`${sectionStationName}${words.SECTION_STATION_DUPLICATE_ALERT}`); } } @@ -101,7 +99,8 @@ export default class SectionManager { const order = removeWhiteSpaceValue(document.getElementById(words.SECTION_ORDER_INPUT).value); const sectionStationSelector = document.getElementById(words.SECTION_STATION_SELECTOR); const sectionStationName = sectionStationSelector.options[sectionStationSelector.selectedIndex].value; - this.addSectionInLine(sectionStationName, order); + const alertText = this.getAlertText(order); + alertText === "" ? this.addSectionInLine(sectionStationName, order) : alert(alertText); } setSectionLineElement(menuButton) { diff --git a/src/station-manager.js b/src/station-manager.js index 762a66c8d..d46e7ef86 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -46,7 +46,7 @@ export default class StationManager{ const lineList = getItemList(words.LINES); let result = false; for(let i = 0; i < lineList.length; i++) { - result = isDuplicateItem(lineList[i], stationName); + result = isDuplicateItem(getItemList(lineList[i]), stationName); if(result) { break; } @@ -54,17 +54,21 @@ export default class StationManager{ return result; } - confirmDeleteStation(deleteButton) { - const isConfirm = confirm(words.DELETE_ALERT); + decideDeleteStation(deleteButton) { const deleteRow = deleteButton.parentElement.parentElement; const stationName = deleteRow.dataset.stationName; + if(this.isStationInLine(stationName)) { + alert(`${stationName}${words.STATION_IN_LINE_ALERT}`); + } + else { + this.deleteStation(stationName, deleteRow); + } + } + + confirmDeleteStation(deleteButton) { + const isConfirm = confirm(words.DELETE_ALERT); if(isConfirm) { - if(this.isStationInLine(stationName)) { - alert(`${stationName}${words.STATION_IN_LINE_ALERT}`); - } - else { - this.deleteStation(stationName, deleteRow); - } + this.decideDeleteStation(deleteButton); } } @@ -103,19 +107,18 @@ export default class StationManager{ return text; } - addStation() { - const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); - const alertText = this.getAlertText(stationInputName); - if(alertText === "") { - if(addItem(words.STATIONS, stationInputName, -1)) { - this.addStationInTable(stationInputName); - } - else { - alert(`${stationInputName}${words.STATION_DUPLICATE_ALERT}`); - } + addStationInStorage(stationInputName) { + if(addItem(words.STATIONS, stationInputName, -1)) { + this.addStationInTable(stationInputName); } else { - alert(alertText); + alert(`${stationInputName}${words.STATION_DUPLICATE_ALERT}`); } } + + addStation() { + const stationInputName = removeWhiteSpaceValue(document.getElementById(words.STATION_NAME_INPUT).value); + const alertText = this.getAlertText(stationInputName); + alertText === "" ? this.addStationInStorage(stationInputName) : alert(alertText); + } } \ No newline at end of file From bb57e476f188fceefe0e36728e403cfee5483ef2 Mon Sep 17 00:00:00 2001 From: maywngml Date: Tue, 15 Dec 2020 20:12:33 +0900 Subject: [PATCH 25/25] =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81:=20?= =?UTF-8?q?=EB=B9=84=EC=A6=88=EB=8B=88=EC=8A=A4=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=EA=B3=BC=20=EB=B7=B0=EB=A5=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/View/line-manager-view.js | 37 ++++++++++++++++++++++ src/View/map-print-manager-view.js | 7 ++++ src/View/section-manager-view.js | 40 +++++++++++++++++++++++ src/View/station-manager-view.js | 26 +++++++++++++++ src/line-manager.js | 51 +++++------------------------- src/map-print-manager.js | 6 ++-- src/section-manager.js | 50 ++++------------------------- src/station-manager.js | 44 ++++++-------------------- 8 files changed, 137 insertions(+), 124 deletions(-) create mode 100644 src/View/line-manager-view.js create mode 100644 src/View/map-print-manager-view.js create mode 100644 src/View/section-manager-view.js create mode 100644 src/View/station-manager-view.js diff --git a/src/View/line-manager-view.js b/src/View/line-manager-view.js new file mode 100644 index 000000000..d69652f67 --- /dev/null +++ b/src/View/line-manager-view.js @@ -0,0 +1,37 @@ +import { + addElement, + addInputElement, + addTableElement, + addSelectElement, + pageInit +} from "../common/elements.js" +import words from "../common/words.js"; + +export function setPage() { + pageInit(); + addElement("h4", words.LINE_NAME, null, null, null); + addInputElement(words.LINE_NAME_INPUT, words.LINE_INPUT_ALERT, null); + addElement("h4", words.LINE_START_STATION, "class", words.LINE_STATION_TEXT, null); + addSelectElement(words.LINE_START_STATION_SELECTOR, null); + addElement("br", null, null, null, null); + addElement("h4", words.LINE_END_STATION, "class", words.LINE_STATION_TEXT, null); + addSelectElement(words.LINE_END_STATION_SELECTOR, null); + addElement("p", null, null, null, null); + addElement("button", words.LINE_ADD, "id",words.LINE_ADD_BUTTON, null); + addElement("h2", words.LINE_LIST, null, null, null); + addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY, null); +} + +export function addTableRow(lineName, lineStartStationName, lineEndStationName) { + const lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); + const row = lineTableTbody.insertRow(); + row.setAttribute("data-line-name", lineName); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + const cell4 = row.insertCell(3); + cell1.innerHTML = lineName; + cell2.innerHTML = lineStartStationName; + cell3.innerHTML = lineEndStationName; + addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); +} \ No newline at end of file diff --git a/src/View/map-print-manager-view.js b/src/View/map-print-manager-view.js new file mode 100644 index 000000000..ec593b071 --- /dev/null +++ b/src/View/map-print-manager-view.js @@ -0,0 +1,7 @@ +import {addElement, pageInit} from "../common/elements.js"; +import words from "../common/words.js"; + +export function setPage() { + pageInit(); + addElement("div", null, "class", words.MAP, null); +} \ No newline at end of file diff --git a/src/View/section-manager-view.js b/src/View/section-manager-view.js new file mode 100644 index 000000000..5b2fb1526 --- /dev/null +++ b/src/View/section-manager-view.js @@ -0,0 +1,40 @@ +import { + addElement, + addInputElement, + addTableElement, + addSelectElement, + addClickEventListener, + pageInit +} from "../common/elements.js"; +import words from "../common/words.js"; + +export function setPage() { + pageInit(); + addElement("h3", words.SECTION_LINE_SELECT_TEXT, null, null, null); +} + +export function addTableRow(section, sectionTableTbody) { + const row = sectionTableTbody.insertRow(); + row.setAttribute("data-section-name", section); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + const cell3 = row.insertCell(2); + cell1.innerHTML = sectionTableTbody.childElementCount - 1; + cell2.innerHTML = section; + addElement("button", words.SECTION_DELETE_TEXT, "class", words.SECTION_DELETE_BUTTON, cell3); +} + +export function setSectionLineElement(menuButton) { + const sectionManagementPart = document.getElementById(words.SECTION_MANAGEMENT_PART); + this.lineName = menuButton.innerText; + sectionManagementPart.innerHTML = ""; + addElement("h3", `${this.lineName} ${words.MANAGEMENT}`, null, null, sectionManagementPart); + addElement("h4", words.SECTION_ADD_TEXT, "id", words.SECTION_ADD_TEXT_ID, sectionManagementPart); + addSelectElement(words.SECTION_STATION_SELECTOR, sectionManagementPart); + addInputElement(words.SECTION_ORDER_INPUT, words.ORDER, sectionManagementPart); + addElement("button", words.ENROLLMENT, "id", words.SECTION_ADD_BUTTON, sectionManagementPart); + addElement("p", null, null, null, sectionManagementPart); + addTableElement([words.ORDER, words.NAME, words.SETTING], words.SECTION_TABLE_TBODY, sectionManagementPart); + addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection()}); + this.setTableContent(); +} \ No newline at end of file diff --git a/src/View/station-manager-view.js b/src/View/station-manager-view.js new file mode 100644 index 000000000..b5aef7208 --- /dev/null +++ b/src/View/station-manager-view.js @@ -0,0 +1,26 @@ +import { + addElement, + addInputElement, + addTableElement, + pageInit, +} from "../common/elements.js"; +import words from "../common/words.js"; + +export function setPage() { + pageInit(); + addElement("h4", words.STATION_NAME, null, null, null); + addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT, null); + addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); + addElement("h2", words.STATION_LIST, null, null, null); + addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY, null); +} + +export function addTableRow(station) { + const stationTableTbody = document.getElementById(words.STATION_TABLE_TBODY); + const row = stationTableTbody.insertRow(); + row.setAttribute("data-station-name", station); + const cell1 = row.insertCell(0); + const cell2 = row.insertCell(1); + cell1.innerHTML = station; + addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); +} \ No newline at end of file diff --git a/src/line-manager.js b/src/line-manager.js index a59abf3c7..a613dc6f1 100644 --- a/src/line-manager.js +++ b/src/line-manager.js @@ -1,12 +1,5 @@ -import { - addElement, - addInputElement, - addTableElement, - addSelectElement, - addClickEventListener, - pageInit, - addClickEventInButtons -} from "./common/elements.js"; +import {setPage, addTableRow} from "./View/line-manager-view.js"; +import {addClickEventListener, addClickEventInButtons} from "./common/elements.js"; import { isEmpty, addItem, @@ -19,34 +12,19 @@ import words from "./common/words.js"; export default class LineManager { constructor() { - this.setPage(); - this.lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); + setPage(); this.setTableContent(); addClickEventListener(document.getElementById(words.LINE_ADD_BUTTON), () => {this.addLine()}); } - - setPage() { - pageInit(); - addElement("h4", words.LINE_NAME, null, null, null); - addInputElement(words.LINE_NAME_INPUT, words.LINE_INPUT_ALERT, null); - addElement("h4", words.LINE_START_STATION, "class", words.LINE_STATION_TEXT, null); - addSelectElement(words.LINE_START_STATION_SELECTOR, null); - addElement("br", null, null, null, null); - addElement("h4", words.LINE_END_STATION, "class", words.LINE_STATION_TEXT, null); - addSelectElement(words.LINE_END_STATION_SELECTOR, null); - addElement("p", null, null, null, null); - addElement("button", words.LINE_ADD, "id",words.LINE_ADD_BUTTON, null); - addElement("h2", words.LINE_LIST, null, null, null); - addTableElement([words.LINE_NAME, `${words.LINE_START_STATION}μ—­`, `${words.LINE_END_STATION}μ—­`, words.SETTING], words.LINE_TABLE_TBODY, null); - } deleteLine(deleteButton) { + const lineTableTbody = document.getElementById(words.LINE_TABLE_TBODY); const deleteRow = deleteButton.parentElement.parentElement; const lineName = deleteRow.dataset.lineName; - this.lineTableTbody.removeChild(deleteRow); + lineTableTbody.removeChild(deleteRow); deleteKey(lineName); deleteItem(words.LINES, lineName); - if(this.lineTableTbody.childElementCount === 0) { + if(lineTableTbody.childElementCount === 0) { deleteKey(words.LINES); } } @@ -58,25 +36,12 @@ export default class LineManager { } } - addTableRow(lineName, lineStartStationName, lineEndStationName) { - const row = this.lineTableTbody.insertRow(); - row.setAttribute("data-line-name", lineName); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - const cell3 = row.insertCell(2); - const cell4 = row.insertCell(3); - cell1.innerHTML = lineName; - cell2.innerHTML = lineStartStationName; - cell3.innerHTML = lineEndStationName; - addElement("button", words.DELETE, "class", words.LINE_DELETE_BUTTON, cell4); - } - setTableContent() { const lineList = getItemList(words.LINES); if(lineList.length > 0) { lineList.forEach(line => { const lineSectionList = getItemList(line); - this.addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); + addTableRow(line, lineSectionList[0], lineSectionList[lineSectionList.length - 1]); }); addClickEventInButtons(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), false); } @@ -88,7 +53,7 @@ export default class LineManager { } addLineInTable(lineInputName, lineStartStationName, lineEndStationName) { - this.addTableRow(lineInputName, lineStartStationName, lineEndStationName); + addTableRow(lineInputName, lineStartStationName, lineEndStationName); this.addLineSection(lineInputName, lineStartStationName, lineEndStationName); addClickEventInButtons(words.LINE_DELETE_BUTTON, this.confirmDeleteLine.bind(this), true); } diff --git a/src/map-print-manager.js b/src/map-print-manager.js index f38590f80..454e6c960 100644 --- a/src/map-print-manager.js +++ b/src/map-print-manager.js @@ -1,11 +1,11 @@ -import {addElement, pageInit} from "./common/elements.js"; +import {setPage} from "./View/map-print-manager-view.js"; +import {addElement} from "./common/elements.js"; import {getItemList} from "./common/items.js"; import words from "./common/words.js"; export default class MapPrintManager { constructor() { - pageInit(); - addElement("div", null, "class", words.MAP, null); + setPage(); this.map = document.querySelector(`.${words.MAP}`); this.printMap(); } diff --git a/src/section-manager.js b/src/section-manager.js index 2978d5f99..229186fe8 100644 --- a/src/section-manager.js +++ b/src/section-manager.js @@ -1,12 +1,5 @@ -import { - addElement, - addInputElement, - addTableElement, - addSelectElement, - addClickEventListener, - pageInit, - addClickEventInButtons -} from "./common/elements.js"; +import {setPage, addTableRow, setSectionLineElement} from "./View/section-manager-view.js"; +import {addElement, addClickEventInButtons} from "./common/elements.js"; import { isEmpty, addItem, @@ -20,32 +13,17 @@ export default class SectionManager { constructor() { this.sectionTableTbody; this.lineName; - this.setPage(); + setPage(); this.setSectionLineMenuButton(); } - setPage() { - pageInit(); - addElement("h3", words.SECTION_LINE_SELECT_TEXT, null, null, null); - } - - addTableRow(section) { - const row = this.sectionTableTbody.insertRow(); - row.setAttribute("data-section-name", section); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - const cell3 = row.insertCell(2); - cell1.innerHTML = this.sectionTableTbody.childElementCount - 1; - cell2.innerHTML = section; - addElement("button", words.SECTION_DELETE_TEXT, "class", words.SECTION_DELETE_BUTTON, cell3); - } - setTableContent() { const sectionList = getItemList(this.lineName); + this.sectionTableTbody = document.querySelector(`#${words.SECTION_TABLE_TBODY}`); this.sectionTableTbody.innerHTML = ""; if(sectionList.length > 0) { sectionList.forEach(section => { - this.addTableRow(section); + addTableRow(section, this.sectionTableTbody); }); addClickEventInButtons(words.SECTION_DELETE_BUTTON, this.confirmDeleteSection.bind(this), false); } @@ -102,22 +80,6 @@ export default class SectionManager { const alertText = this.getAlertText(order); alertText === "" ? this.addSectionInLine(sectionStationName, order) : alert(alertText); } - - setSectionLineElement(menuButton) { - const sectionManagementPart = document.getElementById(words.SECTION_MANAGEMENT_PART); - this.lineName = menuButton.innerText; - sectionManagementPart.innerHTML = ""; - addElement("h3", `${this.lineName} ${words.MANAGEMENT}`, null, null, sectionManagementPart); - addElement("h4", words.SECTION_ADD_TEXT, "id", words.SECTION_ADD_TEXT_ID, sectionManagementPart); - addSelectElement(words.SECTION_STATION_SELECTOR, sectionManagementPart); - addInputElement(words.SECTION_ORDER_INPUT, words.ORDER, sectionManagementPart); - addElement("button", words.ENROLLMENT, "id", words.SECTION_ADD_BUTTON, sectionManagementPart); - addElement("p", null, null, null, sectionManagementPart); - addTableElement([words.ORDER, words.NAME, words.SETTING], words.SECTION_TABLE_TBODY, sectionManagementPart); - addClickEventListener(document.getElementById(words.SECTION_ADD_BUTTON), () => {this.addSection()}); - this.sectionTableTbody = document.querySelector(`#${words.SECTION_TABLE_TBODY}`); - this.setTableContent(); - } setSectionLineMenuButton() { const lineList = getItemList(words.LINES); @@ -125,7 +87,7 @@ export default class SectionManager { lineList.forEach(line => { addElement("button", line, "class", words.SECTION_LINE_MENU_BUTTON, null); }); - addClickEventInButtons(words.SECTION_LINE_MENU_BUTTON, this.setSectionLineElement.bind(this), false); + addClickEventInButtons(words.SECTION_LINE_MENU_BUTTON, setSectionLineElement.bind(this), false); } addElement("div", null, "id", words.SECTION_MANAGEMENT_PART, null); } diff --git a/src/station-manager.js b/src/station-manager.js index d46e7ef86..d35fe13b7 100644 --- a/src/station-manager.js +++ b/src/station-manager.js @@ -1,11 +1,5 @@ -import { - addElement, - addInputElement, - addTableElement, - addClickEventListener, - pageInit, - addClickEventInButtons -} from "./common/elements.js"; +import {setPage, addTableRow} from "./View/station-manager-view.js"; +import {addClickEventListener, addClickEventInButtons} from "./common/elements.js"; import { isEmpty, isDuplicateItem, @@ -19,25 +13,16 @@ import words from "./common/words.js"; export default class StationManager{ constructor() { - this.setPage(); - this.stationTableTbody = document.getElementById(words.STATION_TABLE_TBODY); - this.setTableContent(); - addClickEventListener(document.getElementById(words.STATION_ADD_BUTTON), () => {this.addStation()}); - } - - setPage() { - pageInit(); - addElement("h4", words.STATION_NAME, null, null, null); - addInputElement(words.STATION_NAME_INPUT, words.STATION_INPUT_ALERT, null); - addElement("button", words.STATION_ADD, "id", words.STATION_ADD_BUTTON, null); - addElement("h2", words.STATION_LIST, null, null, null); - addTableElement([words.STATION_NAME, words.SETTING], words.STATION_TABLE_TBODY, null); + setPage(); + this.setTableContent(); + addClickEventListener(document.getElementById(words.STATION_ADD_BUTTON), () => {this.addStation()}); } deleteStation(stationName, deleteRow) { - this.stationTableTbody.removeChild(deleteRow); + const stationTableTbody = document.getElementById(words.STATION_TABLE_TBODY); + stationTableTbody.removeChild(deleteRow); deleteItem(words.STATIONS, stationName); - if(this.stationTableTbody.childElementCount === 0) { + if(stationTableTbody.childElementCount === 0) { deleteKey(words.STATIONS); } } @@ -72,27 +57,18 @@ export default class StationManager{ } } - addTableRow(station) { - const row = this.stationTableTbody.insertRow(); - row.setAttribute("data-station-name", station); - const cell1 = row.insertCell(0); - const cell2 = row.insertCell(1); - cell1.innerHTML = station; - addElement("button", words.DELETE, "class", words.STATION_DELETE_BUTTON, cell2); - } - setTableContent() { const stationList = getItemList(words.STATIONS); if(stationList.length > 0) { stationList.forEach(station => { - this.addTableRow(station); + addTableRow(station); }); addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteStation.bind(this), false); } } addStationInTable(station) { - this.addTableRow(station); + addTableRow(station); addClickEventInButtons(words.STATION_DELETE_BUTTON, this.confirmDeleteStation.bind(this), true); }