[DE SSE mobile] Fix Bug 52821
This commit is contained in:
parent
c45fcb0ca5
commit
24705bec8c
|
@ -32,24 +32,26 @@ class EncodingController extends Component {
|
|||
this.mode = mode;
|
||||
this.advOptions = advOptions;
|
||||
this.formatOptions = formatOptions;
|
||||
this.pages = [];
|
||||
this.pagesName = [];
|
||||
this.encodeData = [];
|
||||
|
||||
const recommendedSettings = this.advOptions.asc_getRecommendedSettings();
|
||||
|
||||
this.initPages();
|
||||
this.initEncodeData();
|
||||
this.valueEncoding = recommendedSettings.asc_getCodePage();
|
||||
|
||||
this.setState({
|
||||
isOpen: true
|
||||
isOpen: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initPages() {
|
||||
initEncodeData() {
|
||||
for (let page of this.advOptions.asc_getCodePages()) {
|
||||
this.pages.push(page.asc_getCodePage());
|
||||
this.pagesName.push(page.asc_getCodePageName());
|
||||
this.encodeData.push({
|
||||
value: page.asc_getCodePage(),
|
||||
displayValue: page.asc_getCodePageName(),
|
||||
lcid: page.asc_getLcid()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,8 +80,7 @@ class EncodingController extends Component {
|
|||
closeModal={this.closeModal}
|
||||
mode={this.mode}
|
||||
onSaveFormat={this.onSaveFormat}
|
||||
pages={this.pages}
|
||||
pagesName={this.pagesName}
|
||||
encodeData={this.encodeData}
|
||||
valueEncoding={this.valueEncoding}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -6,10 +6,10 @@ import { Device } from '../../../../common/mobile/utils/device';
|
|||
const PageEncoding = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t("Settings", { returnObjects: true });
|
||||
const pagesName = props.pagesName;
|
||||
const pages = props.pages;
|
||||
const encodeData = props.encodeData;
|
||||
const [stateEncoding, setStateEncoding] = useState(props.valueEncoding);
|
||||
const nameEncoding = pagesName[pages.indexOf(stateEncoding)];
|
||||
const getIndexNameEncoding = () => encodeData.findIndex(encoding => encoding.value === stateEncoding);
|
||||
const nameEncoding = encodeData[getIndexNameEncoding()].displayValue;
|
||||
const mode = props.mode;
|
||||
|
||||
const changeStateEncoding = value => {
|
||||
|
@ -24,8 +24,7 @@ const PageEncoding = props => {
|
|||
<List>
|
||||
<ListItem title={nameEncoding} link="/encoding-list/" routeProps={{
|
||||
stateEncoding,
|
||||
pages: props.pages,
|
||||
pagesName: props.pagesName,
|
||||
encodeData,
|
||||
changeStateEncoding
|
||||
}}></ListItem>
|
||||
</List>
|
||||
|
@ -45,19 +44,18 @@ const PageEncodingList = props => {
|
|||
const { t } = useTranslation();
|
||||
const _t = t("Settings", { returnObjects: true });
|
||||
const [currentEncoding, changeCurrentEncoding] = useState(props.stateEncoding);
|
||||
const pages = props.pages;
|
||||
const pagesName = props.pagesName;
|
||||
const encodeData = props.encodeData;
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<Navbar title={_t.txtDownloadTxt} backLink={_t.textBack} />
|
||||
<BlockTitle>{_t.textChooseEncoding}</BlockTitle>
|
||||
<List>
|
||||
{pagesName.map((name, index) => {
|
||||
{encodeData.map((encoding, index) => {
|
||||
return (
|
||||
<ListItem radio checked={currentEncoding === pages[index]} title={name} key={index} value={pages[index]} onChange={() => {
|
||||
changeCurrentEncoding(pages[index]);
|
||||
props.changeStateEncoding(pages[index]);
|
||||
<ListItem radio checked={currentEncoding === encoding.value} title={encoding.displayValue} key={index} value={encoding.value} after={encoding.lcid} onChange={() => {
|
||||
changeCurrentEncoding(encoding.value);
|
||||
props.changeStateEncoding(encoding.value);
|
||||
f7.views.current.router.back();
|
||||
}}></ListItem>
|
||||
)
|
||||
|
@ -79,8 +77,7 @@ class EncodingView extends Component {
|
|||
onSaveFormat={this.props.onSaveFormat}
|
||||
closeModal={this.props.closeModal}
|
||||
mode={this.props.mode}
|
||||
pages={this.props.pages}
|
||||
pagesName={this.props.pagesName}
|
||||
encodeData={this.props.encodeData}
|
||||
valueEncoding={this.props.valueEncoding}
|
||||
/>
|
||||
</Popup>
|
||||
|
@ -108,8 +105,7 @@ const Encoding = props => {
|
|||
closeModal={props.closeModal}
|
||||
onSaveFormat={props.onSaveFormat}
|
||||
mode={props.mode}
|
||||
pages={props.pages}
|
||||
pagesName={props.pagesName}
|
||||
encodeData={props.encodeData}
|
||||
valueEncoding={props.valueEncoding}
|
||||
/>
|
||||
)
|
||||
|
|
|
@ -38,12 +38,11 @@ class EncodingController extends Component {
|
|||
this.mode = mode;
|
||||
this.advOptions = advOptions;
|
||||
this.formatOptions = formatOptions;
|
||||
this.pages = [];
|
||||
this.pagesName = [];
|
||||
this.encodeData = [];
|
||||
|
||||
const recommendedSettings = this.advOptions.asc_getRecommendedSettings();
|
||||
|
||||
this.initPages();
|
||||
this.initEncodeData();
|
||||
this.valueEncoding = recommendedSettings.asc_getCodePage();
|
||||
this.valueDelimeter = recommendedSettings && recommendedSettings.asc_getDelimiter() ? recommendedSettings.asc_getDelimiter() : 4;
|
||||
|
||||
|
@ -53,10 +52,13 @@ class EncodingController extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
initPages() {
|
||||
initEncodeData() {
|
||||
for (let page of this.advOptions.asc_getCodePages()) {
|
||||
this.pages.push(page.asc_getCodePage());
|
||||
this.pagesName.push(page.asc_getCodePageName());
|
||||
this.encodeData.push({
|
||||
value: page.asc_getCodePage(),
|
||||
displayValue: page.asc_getCodePageName(),
|
||||
lcid: page.asc_getLcid()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,8 +87,7 @@ class EncodingController extends Component {
|
|||
closeModal={this.closeModal}
|
||||
mode={this.mode}
|
||||
onSaveFormat={this.onSaveFormat}
|
||||
pages={this.pages}
|
||||
pagesName={this.pagesName}
|
||||
encodeData={this.encodeData}
|
||||
namesDelimeter={this.namesDelimeter}
|
||||
valueEncoding={this.valueEncoding}
|
||||
valueDelimeter={this.valueDelimeter}
|
||||
|
|
|
@ -6,13 +6,13 @@ import { Device } from '../../../../common/mobile/utils/device';
|
|||
const PageEncoding = props => {
|
||||
const { t } = useTranslation();
|
||||
const _t = t("View.Settings", { returnObjects: true });
|
||||
const pagesName = props.pagesName;
|
||||
const pages = props.pages;
|
||||
const encodeData = props.encodeData;
|
||||
const valuesDelimeter = props.valuesDelimeter;
|
||||
const namesDelimeter = props.namesDelimeter;
|
||||
const [stateEncoding, setStateEncoding] = useState(props.valueEncoding);
|
||||
const [stateDelimeter, setStateDelimeter] = useState(props.valueDelimeter);
|
||||
const nameEncoding = pagesName[pages.indexOf(stateEncoding)];
|
||||
const getIndexNameEncoding = () => encodeData.findIndex(encoding => encoding.value === stateEncoding);
|
||||
const nameEncoding = encodeData[getIndexNameEncoding()].displayValue;
|
||||
const nameDelimeter = namesDelimeter[valuesDelimeter.indexOf(stateDelimeter)];
|
||||
const mode = props.mode;
|
||||
|
||||
|
@ -41,8 +41,7 @@ const PageEncoding = props => {
|
|||
<List>
|
||||
<ListItem title={nameEncoding} link="/encoding-list/" routeProps={{
|
||||
stateEncoding,
|
||||
pages: props.pages,
|
||||
pagesName: props.pagesName,
|
||||
encodeData,
|
||||
changeStateEncoding
|
||||
}}></ListItem>
|
||||
</List>
|
||||
|
@ -62,19 +61,18 @@ const PageEncodingList = props => {
|
|||
const { t } = useTranslation();
|
||||
const _t = t("View.Settings", { returnObjects: true });
|
||||
const [currentEncoding, changeCurrentEncoding] = useState(props.stateEncoding);
|
||||
const pages = props.pages;
|
||||
const pagesName = props.pagesName;
|
||||
const encodeData = props.encodeData;
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<Navbar title={_t.txtDownloadCsv} backLink={_t.textBack} />
|
||||
<BlockTitle>{_t.textChooseEncoding}</BlockTitle>
|
||||
<List>
|
||||
{pagesName.map((name, index) => {
|
||||
{encodeData.map((encoding, index) => {
|
||||
return (
|
||||
<ListItem radio checked={currentEncoding === pages[index]} title={name} key={index} value={pages[index]} onChange={() => {
|
||||
changeCurrentEncoding(pages[index]);
|
||||
props.changeStateEncoding(pages[index]);
|
||||
<ListItem radio checked={currentEncoding === encoding.value} title={encoding.displayValue} key={index} value={encoding.value} after={encoding.lcid} onChange={() => {
|
||||
changeCurrentEncoding(encoding.value);
|
||||
props.changeStateEncoding(encoding.value);
|
||||
f7.views.current.router.back();
|
||||
}}></ListItem>
|
||||
)
|
||||
|
@ -122,8 +120,7 @@ class EncodingView extends Component {
|
|||
onSaveFormat={this.props.onSaveFormat}
|
||||
closeModal={this.props.closeModal}
|
||||
mode={this.props.mode}
|
||||
pages={this.props.pages}
|
||||
pagesName={this.props.pagesName}
|
||||
encodeData={this.props.encodeData}
|
||||
namesDelimeter={this.props.namesDelimeter}
|
||||
valueEncoding={this.props.valueEncoding}
|
||||
valueDelimeter={this.props.valueDelimeter}
|
||||
|
@ -158,8 +155,7 @@ const Encoding = props => {
|
|||
closeModal={props.closeModal}
|
||||
onSaveFormat={props.onSaveFormat}
|
||||
mode={props.mode}
|
||||
pages={props.pages}
|
||||
pagesName={props.pagesName}
|
||||
encodeData={props.encodeData}
|
||||
namesDelimeter={props.namesDelimeter}
|
||||
valueEncoding={props.valueEncoding}
|
||||
valueDelimeter={props.valueDelimeter}
|
||||
|
|
Loading…
Reference in a new issue