1.2.0 • Published 5 years ago

zipcode-tw-react v1.2.0

Weekly downloads
27
License
MIT
Repository
github
Last release
5 years ago

zipcode-tw-react

提供台灣縣市、行政區下拉選單以及郵遞區號輸入欄位組合的React Component
藉由RawData快速進行郵遞區號切換,並提供地址合併顯示。

travis-ci Status Coverage Status License

Feature

  • 挑選台灣縣市、行政區下拉選單,快速帶出郵遞區號。
  • 提供可自定義台灣縣市下拉選單排序(countySort)。
  • 輸入郵遞區號,快速帶出台灣縣市、行政區。
  • 提供完整地址(fullAddress)或路段地址(address)欄位傳入,合併顯示郵遞區號及地址。
  • 可自定義下拉選單、輸入欄位、地址顯示欄位的CSS, Style,達到畫面的一致性。

Demo

Try it online: https://chris-tsai.github.io/

pic

Installation

npm install zipcode-tw-react --save

or use package.json

"dependencies": {
      ...
    + "zipcode-tw-react": "^1.2.0",
 },

Usage

import {ZipCodeTW} from "zipcode-tw-react";

<ZipCodeTW displayType="text"
          ...
/>

Example : zipcode-tw-react-example

Props

Field
NameTypeDefaultDescription
displayTypeone of: 'text', 'display''text'displayType= display1. 以span顯示且包含readOnly & disabled屬性2. 提供fullAddress、address參數合併顯示郵遞區號及地址
countySortobject{"基隆市": 1, "台北市":2, "新北市":3, "桃園市":4, "新竹市":5, "新竹縣":6, "苗栗縣":7, "台中市":8, "彰化縣":9, "南投縣":10,"雲林縣":11, "嘉義市":12, "嘉義縣":13, "台南市":14, "高雄市":15, "屏東縣":16, "台東縣":17, "花蓮縣":18, "宜蘭縣":19, "澎湖縣":20,"金門縣":21, "連江縣":22}
zipCodePositionLastbooltrueDecide zipCode input text position, when displayType= display, position is fixed
countyFieldNamestring'county'
countyValuestring
districtFieldNamestring'district'
districtValuestring
zipCodeFieldNamestring'zipCode'
zipCodeValuestring
countyClassstring'form-control'
countyStyleobject{}
districtClassstring'form-control'
districtStyleobjectdisplayType= 'text'預設為 {marginLeft:'5px', minWidth:'107px', paddingRight:'0px'}
zipClassstring'form-control'
zipStyleobjectdisplayType= 'text'預設為 {marginLeft:'5px', width: '50px'}
zipCodePlaceholderstring
fullAddressstring完整地址(優化顯示)
addressstring路段地址資訊(優化顯示)
addressClassstring'form-control'
addressStyleobject{}
Method
NameReturnDescription
handleChangeCounty{ countyFieldName, countyValue, districtFieldName, districtValue, zipFieldName, zipValue }
handleChangeDistrict{ countyFieldName, countyValue, districtFieldName, districtValue, zipFieldName, zipValue }
handleChangeZipCode{ zipFieldName, zipValue }
handleBlurZipCode{ countyFieldName, countyValue, districtFieldName, districtValue, zipFieldName, zipValue }
handleZipCodeNotExists{ countyFieldName, countyValue, districtFieldName, districtValue, zipFieldName, zipValue, origZipCode }
1.2.0

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4-beta2

6 years ago

1.0.4-beta1

6 years ago

1.0.4

6 years ago

1.0.3-beta4

6 years ago

1.0.3-beta3

6 years ago

1.0.3-beta2

6 years ago

1.0.3-beta1

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1-beta7

6 years ago

0.0.1-beta6

6 years ago

0.0.1-beta5

6 years ago

0.0.1-beta4

6 years ago

0.0.1-beta3

6 years ago

0.0.1-beta2

6 years ago