@sydsoft/base 1.29.0 → 1.31.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
type gridValues =
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { typeJustifyContent, typeSpacingValues } from '../grid';
|
|
3
|
+
type gridValues = 'auto' | 'full' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
4
4
|
type grid = {
|
|
5
5
|
xs?: gridValues;
|
|
6
6
|
sm?: gridValues;
|
|
@@ -30,7 +30,7 @@ interface Props {
|
|
|
30
30
|
label: grid;
|
|
31
31
|
input: grid;
|
|
32
32
|
};
|
|
33
|
-
formType:
|
|
33
|
+
formType: 'label' | 'noLabel';
|
|
34
34
|
justifyContent: typeJustifyContent;
|
|
35
35
|
rowSpacing?: typeSpacingValues;
|
|
36
36
|
colSpacing?: typeSpacingValues;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import React, { memo, useEffect, useMemo } from 'react';
|
|
4
|
+
import { Col, Row } from '../grid';
|
|
5
|
+
import { isDev } from '../_lib/baseFunctions';
|
|
6
|
+
import { Label } from './Label';
|
|
7
7
|
export var FormOlustur = memo(function FunctionMemo(props) {
|
|
8
8
|
var form = props.form, formOgeler = props.formOgeler, onChange = props.onChange, formType = props.formType, sabitGrid = props.sabitGrid, justifyContent = props.justifyContent, rowSpacing = props.rowSpacing, colSpacing = props.colSpacing;
|
|
9
9
|
useEffect(function () {
|
|
10
10
|
if (formOgeler && onChange && form) {
|
|
11
11
|
formOgeler.forEach(function (formOgeler) {
|
|
12
|
-
var _a, _b, _c, _d
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
var fieldName = (_b = (_a = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.name;
|
|
14
|
+
if (formOgeler.noRender && fieldName && form[fieldName] && form[fieldName] != '') {
|
|
15
|
+
isDev && console.log('noRenderGuncelle');
|
|
16
|
+
if ((formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) && ((_d = (_c = formOgeler === null || formOgeler === void 0 ? void 0 : formOgeler.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.name)) {
|
|
16
17
|
onChange({
|
|
17
18
|
target: {
|
|
18
|
-
name:
|
|
19
|
-
value:
|
|
19
|
+
name: fieldName,
|
|
20
|
+
value: ''
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -37,14 +38,14 @@ export var FormOlustur = memo(function FunctionMemo(props) {
|
|
|
37
38
|
newProps = __assign(__assign({}, newProps), { onChange: onChange });
|
|
38
39
|
}
|
|
39
40
|
if (onChange && form && component.props.name && !component.props.value) {
|
|
40
|
-
newProps = __assign(__assign({}, newProps), { value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) :
|
|
41
|
+
newProps = __assign(__assign({}, newProps), { value: form[component.props.name] && form[component.props.name].length > 0 ? String(form[component.props.name]) : '' });
|
|
41
42
|
}
|
|
42
|
-
if (formType ===
|
|
43
|
-
newProps = __assign(__assign({}, newProps), { label:
|
|
43
|
+
if (formType === 'label')
|
|
44
|
+
newProps = __assign(__assign({}, newProps), { label: '' });
|
|
44
45
|
var detectLabel = label || component.props.label;
|
|
45
46
|
gridLabel = __assign(__assign({}, sabitGrid.label), gridLabel);
|
|
46
47
|
gridInput = __assign(__assign({}, sabitGrid.input), gridInput);
|
|
47
|
-
return (_jsxs(Row, __assign({ justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing }, propsRow, { children: [formType ===
|
|
48
|
+
return (_jsxs(Row, __assign({ justifyContent: justifyContent, rowSpacing: rowSpacing, colSpacing: colSpacing }, propsRow, { children: [formType === 'label' && detectLabel && (_jsx(Col, __assign({}, gridLabel, { children: _jsx(Label, __assign({ required: component.props.required }, propsLabel, { children: detectLabel })) }))), _jsx(Col, __assign({}, gridInput, { children: React.cloneElement(component, newProps) }))] }), i));
|
|
48
49
|
});
|
|
49
50
|
}, [form, formOgeler, onChange, formType, sabitGrid, justifyContent, rowSpacing, colSpacing]);
|
|
50
51
|
return _jsx(React.Fragment, { children: result });
|