@redneckz/wildless-cms-uni-blocks 0.14.1052 → 0.14.1053
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.
- package/bundle/bundle.umd.js +10 -2
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/retail/components/Fields/SelectField.js +10 -1
- package/dist/retail/components/Fields/SelectField.js.map +1 -1
- package/lib/retail/components/Fields/SelectField.js +10 -1
- package/lib/retail/components/Fields/SelectField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +10 -2
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/retail/components/Fields/SelectField.js +10 -1
- package/mobile/dist/retail/components/Fields/SelectField.js.map +1 -1
- package/mobile/lib/retail/components/Fields/SelectField.js +10 -1
- package/mobile/lib/retail/components/Fields/SelectField.js.map +1 -1
- package/mobile/src/retail/components/Fields/SelectField.tsx +13 -0
- package/package.json +1 -1
- package/src/retail/components/Fields/SelectField.tsx +13 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.SelectField = void 0;
|
|
3
3
|
const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
4
|
+
const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
|
|
4
5
|
const SelectControl_1 = require("../../../ui-kit/Select/SelectControl");
|
|
5
6
|
const UniBlock_1 = require("../../../UniBlock/UniBlock");
|
|
6
7
|
exports.SelectField = (0, UniBlock_1.UniBlock)(({ field, source, fieldName, placeholder = 'Выберите из списка',
|
|
@@ -10,6 +11,14 @@ options, onChange, ...rest }) => {
|
|
|
10
11
|
key: _.key || '',
|
|
11
12
|
text: _.value,
|
|
12
13
|
})) || [];
|
|
13
|
-
|
|
14
|
+
const fieldProps = field(fieldName);
|
|
15
|
+
const currentValue = fieldProps?.value;
|
|
16
|
+
const updateValue = (0, hooks_1.useMemo)(() => {
|
|
17
|
+
if (currentValue?.key && !currentValue?.text) {
|
|
18
|
+
return leadOptions.find((opt) => opt.key === currentValue.key) ?? currentValue;
|
|
19
|
+
}
|
|
20
|
+
return currentValue;
|
|
21
|
+
}, [currentValue, leadOptions]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(SelectControl_1.SelectControl, { placeholder: placeholder, options: leadOptions, ...field(fieldName), value: updateValue, ...rest, onChange: onChange ?? field(fieldName)?.onChange }));
|
|
14
23
|
});
|
|
15
24
|
//# sourceMappingURL=SelectField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/SelectField.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/SelectField.tsx"],"names":[],"mappings":";;;AAAA,uDAAsD;AAMtD,wEAAqE;AACrE,yDAAsD;AAiBzC,QAAA,WAAW,GAAG,IAAA,mBAAQ,EACjC,CAAC,EACC,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,GAAG,oBAAoB;AAClC,6DAA6D;AAC7D,OAAO,EACP,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,WAAW,GACf,MAAM,EAAE,GAAG,CAAC,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC;QAClC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,KAAK;KACd,CAAC,CAAC,IAAI,EAAE,CAAC;IAEZ,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,UAAU,EAAE,KAA2B,CAAC;IAE7D,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,IAAI,YAAY,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE;YAC5C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC;SAChF;QAED,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,uBAAC,6BAAa,IACZ,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,WAAW,KAChB,KAAK,CAAC,SAAS,CAAC,EACpB,KAAK,EAAE,WAAW,KACd,IAAI,EACR,QAAQ,EAAE,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,QAAQ,GAChD,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
3
|
import { SelectControl } from '../../../ui-kit/Select/SelectControl.js';
|
|
3
4
|
import { UniBlock } from '../../../UniBlock/UniBlock.js';
|
|
4
5
|
export const SelectField = UniBlock(({ field, source, fieldName, placeholder = 'Выберите из списка',
|
|
@@ -8,6 +9,14 @@ options, onChange, ...rest }) => {
|
|
|
8
9
|
key: _.key || '',
|
|
9
10
|
text: _.value,
|
|
10
11
|
})) || [];
|
|
11
|
-
|
|
12
|
+
const fieldProps = field(fieldName);
|
|
13
|
+
const currentValue = fieldProps?.value;
|
|
14
|
+
const updateValue = useMemo(() => {
|
|
15
|
+
if (currentValue?.key && !currentValue?.text) {
|
|
16
|
+
return leadOptions.find((opt) => opt.key === currentValue.key) ?? currentValue;
|
|
17
|
+
}
|
|
18
|
+
return currentValue;
|
|
19
|
+
}, [currentValue, leadOptions]);
|
|
20
|
+
return (_jsx(SelectControl, { placeholder: placeholder, options: leadOptions, ...field(fieldName), value: updateValue, ...rest, onChange: onChange ?? field(fieldName)?.onChange }));
|
|
12
21
|
});
|
|
13
22
|
//# sourceMappingURL=SelectField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/SelectField.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SelectField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/SelectField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAMtD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAiBtD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CACjC,CAAC,EACC,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,GAAG,oBAAoB;AAClC,6DAA6D;AAC7D,OAAO,EACP,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,WAAW,GACf,MAAM,EAAE,GAAG,CAAC,CAAC,CAAiB,EAAE,EAAE,CAAC,CAAC;QAClC,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,KAAK;KACd,CAAC,CAAC,IAAI,EAAE,CAAC;IAEZ,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,UAAU,EAAE,KAA2B,CAAC;IAE7D,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,IAAI,YAAY,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE;YAC5C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC;SAChF;QAED,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,KAAC,aAAa,IACZ,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,WAAW,KAChB,KAAK,CAAC,SAAS,CAAC,EACpB,KAAK,EAAE,WAAW,KACd,IAAI,EACR,QAAQ,EAAE,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,EAAE,QAAQ,GAChD,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
1
2
|
import { type DisabledProps } from '../../../model/DisabledProps';
|
|
2
3
|
import { type LabelProps } from '../../../model/HeadlineType';
|
|
3
4
|
import { type PlaceholderProps } from '../../../model/PlaceholderProps';
|
|
@@ -38,11 +39,23 @@ export const SelectField = UniBlock<SelectFieldProps>(
|
|
|
38
39
|
text: _.value,
|
|
39
40
|
})) || [];
|
|
40
41
|
|
|
42
|
+
const fieldProps = field(fieldName);
|
|
43
|
+
const currentValue = fieldProps?.value as Option | undefined;
|
|
44
|
+
|
|
45
|
+
const updateValue = useMemo(() => {
|
|
46
|
+
if (currentValue?.key && !currentValue?.text) {
|
|
47
|
+
return leadOptions.find((opt) => opt.key === currentValue.key) ?? currentValue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return currentValue;
|
|
51
|
+
}, [currentValue, leadOptions]);
|
|
52
|
+
|
|
41
53
|
return (
|
|
42
54
|
<SelectControl
|
|
43
55
|
placeholder={placeholder}
|
|
44
56
|
options={leadOptions}
|
|
45
57
|
{...field(fieldName)}
|
|
58
|
+
value={updateValue}
|
|
46
59
|
{...rest}
|
|
47
60
|
onChange={onChange ?? field(fieldName)?.onChange}
|
|
48
61
|
/>
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
|
|
1
2
|
import { type DisabledProps } from '../../../model/DisabledProps';
|
|
2
3
|
import { type LabelProps } from '../../../model/HeadlineType';
|
|
3
4
|
import { type PlaceholderProps } from '../../../model/PlaceholderProps';
|
|
@@ -38,11 +39,23 @@ export const SelectField = UniBlock<SelectFieldProps>(
|
|
|
38
39
|
text: _.value,
|
|
39
40
|
})) || [];
|
|
40
41
|
|
|
42
|
+
const fieldProps = field(fieldName);
|
|
43
|
+
const currentValue = fieldProps?.value as Option | undefined;
|
|
44
|
+
|
|
45
|
+
const updateValue = useMemo(() => {
|
|
46
|
+
if (currentValue?.key && !currentValue?.text) {
|
|
47
|
+
return leadOptions.find((opt) => opt.key === currentValue.key) ?? currentValue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return currentValue;
|
|
51
|
+
}, [currentValue, leadOptions]);
|
|
52
|
+
|
|
41
53
|
return (
|
|
42
54
|
<SelectControl
|
|
43
55
|
placeholder={placeholder}
|
|
44
56
|
options={leadOptions}
|
|
45
57
|
{...field(fieldName)}
|
|
58
|
+
value={updateValue}
|
|
46
59
|
{...rest}
|
|
47
60
|
onChange={onChange ?? field(fieldName)?.onChange}
|
|
48
61
|
/>
|