@vnejs/plugins.view.coralina.settings.defaults 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/view/index.jsx +12 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.view.coralina.settings.defaults",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/view/index.jsx CHANGED
@@ -1,7 +1,7 @@
1
- import React, { useCallback, useEffect, useMemo, useState } from "react";
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
2
  import { createRoot } from "react-dom/client";
3
3
 
4
- import { Flex, Text, Screen, Settings, PositionBox } from "@vnejs/uis.base";
4
+ import { Flex, Text, Screen, Settings, PositionBox } from "@vnejs/uis.react";
5
5
 
6
6
  const SettingsDefaults = ({ store, onMount, ...props } = {}) => {
7
7
  const [{ isShow = false, locs = {}, tab = {}, bgSrc = "" }, setState] = useState({});
@@ -23,27 +23,19 @@ const SettingsDefaults = ({ store, onMount, ...props } = {}) => {
23
23
 
24
24
  const settings = useMemo(() => (tab.fields ? tab.fields.map(mapFields) : []), [tab, mapFields]);
25
25
 
26
- const propsTitle = useMemo(() => ({ ...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.title, text: locs[tab.titleLocKey] }), [locs, tab]);
27
- const propsSettings = useMemo(() => ({ ...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.settings, settings }), [settings]);
28
- const propsAccept = useMemo(
29
- () => ({ ...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.accept, text: locs[tab.acceptLocKey], onClick: onAccept }),
30
- [locs, tab],
31
- );
26
+ const propsByView = props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS;
27
+
28
+ const propsScreen = useMemo(() => ({ ...propsByView.screen, isShow, bgSrc }), [isShow, bgSrc]);
29
+ const propsTitle = useMemo(() => ({ ...propsByView.title, text: locs[tab.titleLocKey] }), [locs, tab]);
30
+ const propsSettings = useMemo(() => ({ ...propsByView.settings, settings, selectedIndex: 0, selectedIndexInner: 0 }), [settings]);
31
+ const propsAccept = useMemo(() => ({ ...propsByView.accept, text: locs[tab.acceptLocKey], onClick: onAccept }), [locs, tab]);
32
32
 
33
33
  return (
34
- <Screen
35
- {...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.screen}
36
- isShow={isShow}
37
- bgSrc={bgSrc}
38
- >
39
- <PositionBox {...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.position}>
40
- <Flex {...props.PARAMS.SETTINGS_DEFAULTS_VIEW.VIEW_PROPS.flex}>
34
+ <Screen {...propsScreen}>
35
+ <PositionBox {...propsByView.position}>
36
+ <Flex {...propsByView.flex}>
41
37
  <Text {...propsTitle} />
42
- <Settings
43
- {...propsSettings}
44
- selectedIndex={0}
45
- selectedIndexInner={0}
46
- />
38
+ <Settings {...propsSettings} />
47
39
  <Text {...propsAccept} />
48
40
  </Flex>
49
41
  </PositionBox>