forked from didi/pile.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
renmaomin
committed
Apr 11, 2019
1 parent
44e8208
commit 0e1896e
Showing
13 changed files
with
2,517 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,227 changes: 1,227 additions & 0 deletions
1,227
packages/local-provider/lib/local-provider.esm.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"name": "@pile/local-provider", | ||
"name": "@pile-ui/local-provider", | ||
"version": "2.0.4-alpha.0", | ||
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM", | ||
"keywords": [], | ||
"author": "wutaosusan <[email protected]>", | ||
"homepage": "https://didi.github.io/pile.js/docs/tree/master/local-provider#readme", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"module": "lib/local-provider.esm.js", | ||
"main": "lib/local-provider.js", | ||
"module": "src/index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { default as LocaleProvider} from './localeProvider'; | ||
export { LocaleReceiver } from './localeReceiver'; | ||
export { default as LocaleProvider } from './localeProvider'; | ||
export { default as LocaleReceiver } from './localeReceiver'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
locale: 'en', | ||
// todo | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import * as React from 'react'; | ||
import zhCn from './lang/zh_CN'; | ||
|
||
import zh_cn from './lang/zh_CN' | ||
export const LangContext = React.createContext(zh_cn); | ||
const LangContext = React.createContext(zhCn); | ||
|
||
export default LangContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
import * as React from 'react'; | ||
import { LangContext } from './langContext'; | ||
export default class LocaleProvider extends React.Component{ | ||
render() { | ||
const { lang, children } = this.props | ||
return ( | ||
<LangContext.Provider value={lang}> | ||
{children} | ||
</LangContext.Provider> | ||
) | ||
} | ||
} | ||
import PropTypes from 'prop-types'; | ||
import LangContext from './langContext'; | ||
|
||
const LocaleProvider = ({ lang, children }) => { | ||
return <LangContext.Provider value={lang}>{children}</LangContext.Provider>; | ||
}; | ||
|
||
LocaleProvider.defaultProps = { | ||
children: null, | ||
}; | ||
LocaleProvider.propTypes = { | ||
lang: PropTypes.shape({ | ||
locale: PropTypes.oneOf(['en', 'zh-cn']), | ||
}).isRequired, | ||
children: PropTypes.oneOfType([ | ||
PropTypes.arrayOf(PropTypes.node), | ||
PropTypes.node, | ||
]), | ||
}; | ||
|
||
export default LocaleProvider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { LangContext } from './langContext'; | ||
export default class LocaleReceiver extends React.Component{ | ||
render(){ | ||
const { children } = this.props | ||
return ( | ||
<LangContext.Consumer> | ||
{children} | ||
</LangContext.Consumer> | ||
) | ||
} | ||
} | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import LangContext from './langContext'; | ||
|
||
const LocaleReceiver = ({ children }) => { | ||
return <LangContext.Consumer>{children}</LangContext.Consumer>; | ||
}; | ||
|
||
LocaleReceiver.defaultProps = { | ||
children() {}, | ||
}; | ||
LocaleReceiver.propTypes = { | ||
children: PropTypes.func, | ||
}; | ||
|
||
export default LocaleReceiver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"form" | ||
], | ||
"author": "renmaomin <[email protected]> (https://github.com/renmm)", | ||
"homepage": "https://didi.github.io/pile.js/docs/tree/master/validator#readme", | ||
"homepage": "https://didi.github.io/pile.js/docs", | ||
"license": "MIT", | ||
"module": "lib/validator.esm.js", | ||
"main": "lib/validator.js", | ||
|
@@ -19,7 +19,7 @@ | |
"lib" | ||
], | ||
"publishConfig": { | ||
"registry": "http:https://npm.intra.xiaojukeji.com/" | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|