datasync-dynamic-form 1.3.3 → 1.3.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.
package/dist/DsDynamicForm.js
CHANGED
|
@@ -394,8 +394,9 @@ export class DsDynamicForm extends Component {
|
|
|
394
394
|
}
|
|
395
395
|
};
|
|
396
396
|
this._colRendering = (col) => {
|
|
397
|
+
var _a, _b, _c, _d;
|
|
397
398
|
try {
|
|
398
|
-
return (_jsx(ReactstrapCol, { xs:
|
|
399
|
+
return (_jsx(ReactstrapCol, { xs: (_a = this.props.col_xs) !== null && _a !== void 0 ? _a : 12, sm: (_b = this.props.col_sm) !== null && _b !== void 0 ? _b : 12, md: (_c = this.props.col_md) !== null && _c !== void 0 ? _c : 6, lg: (_d = this.props.col_lg) !== null && _d !== void 0 ? _d : 4, id: `${col.Id ? col.Id : ''}`, children: col.Fields.map((field, ii) => {
|
|
399
400
|
return this._fieldRendering(field, ii);
|
|
400
401
|
}) }));
|
|
401
402
|
}
|
|
@@ -469,24 +470,27 @@ export class DsDynamicForm extends Component {
|
|
|
469
470
|
}
|
|
470
471
|
};
|
|
471
472
|
this._cancelButton = () => {
|
|
473
|
+
var _a, _b, _c, _d;
|
|
472
474
|
let buttonIsHidden = (this.props.read_only || (this.props.buttons_options && this.props.buttons_options.cancel_button_hidden)) ? true : false;
|
|
473
475
|
let buttonCaption = (this.props.buttons_options && this.props.buttons_options.cancel_button_caption) ? this.props.buttons_options.cancel_button_caption : "Annuler";
|
|
474
476
|
if (buttonIsHidden)
|
|
475
477
|
return (_jsx(_Fragment, {}));
|
|
476
478
|
else {
|
|
477
|
-
return (_jsx(ReactstrapCol, { xs:
|
|
479
|
+
return (_jsx(ReactstrapCol, { xs: (_a = this.props.col_xs) !== null && _a !== void 0 ? _a : 12, sm: (_b = this.props.col_sm) !== null && _b !== void 0 ? _b : 12, md: (_c = this.props.col_md) !== null && _c !== void 0 ? _c : 6, lg: (_d = this.props.col_lg) !== null && _d !== void 0 ? _d : 4, children: _jsx(Button, { id: "dsdf_clear_button", block: true, className: "btn-round", color: "danger", outline: true, type: "reset", onClick: () => { this.clearForm(); }, children: buttonCaption }) }));
|
|
478
480
|
}
|
|
479
481
|
};
|
|
480
482
|
this._submitButton = () => {
|
|
483
|
+
var _a, _b, _c, _d;
|
|
481
484
|
let buttonIsHidden = (this.props.read_only || (this.props.buttons_options && this.props.buttons_options.submit_button_hidden)) ? true : false;
|
|
482
485
|
let buttonCaption = (this.props.buttons_options && this.props.buttons_options.submit_button_caption) ? this.props.buttons_options.submit_button_caption : "Soumettre";
|
|
483
486
|
if (buttonIsHidden)
|
|
484
487
|
return (_jsx(_Fragment, {}));
|
|
485
488
|
else {
|
|
486
|
-
return (_jsx(ReactstrapCol, { xs:
|
|
489
|
+
return (_jsx(ReactstrapCol, { xs: (_a = this.props.col_xs) !== null && _a !== void 0 ? _a : 12, sm: (_b = this.props.col_sm) !== null && _b !== void 0 ? _b : 12, md: (_c = this.props.col_md) !== null && _c !== void 0 ? _c : 6, lg: (_d = this.props.col_lg) !== null && _d !== void 0 ? _d : 4, children: _jsx(Button, { id: "dsdf_submit_button", block: true, className: "btn-round", color: "danger", outline: true, type: "submit", onClick: () => { this.onClickSubmitFormHandler(); }, children: buttonCaption }) }));
|
|
487
490
|
}
|
|
488
491
|
};
|
|
489
492
|
this.render = () => {
|
|
493
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
490
494
|
return (_jsxs(_Fragment, { children: [_jsx(_Fragment, {}), !this.state.form &&
|
|
491
495
|
_jsx("div", { children: _jsx("h1", { children: "Form loading..." }) }), !(this.state.form &&
|
|
492
496
|
this.state.form.Pages) &&
|
|
@@ -499,11 +503,11 @@ export class DsDynamicForm extends Component {
|
|
|
499
503
|
return (_jsx("div", { children: this._rowRendering(row) }, rowIndex));
|
|
500
504
|
}) }, pageIndex));
|
|
501
505
|
}) }), _jsxs(ReactstrapRow, { id: "dsdf_buttons_container", className: "buttons-row", children: [this._cancelButton(), this._submitButton(), this.props.custom_button_caption &&
|
|
502
|
-
_jsx(ReactstrapCol, { xs:
|
|
506
|
+
_jsx(ReactstrapCol, { xs: (_a = this.props.col_xs) !== null && _a !== void 0 ? _a : 12, sm: (_b = this.props.col_sm) !== null && _b !== void 0 ? _b : 12, md: (_c = this.props.col_md) !== null && _c !== void 0 ? _c : 6, lg: (_d = this.props.col_lg) !== null && _d !== void 0 ? _d : 4, children: _jsx(Button, { id: "dsdf_custom_button", block: true, className: "btn-round", color: "primary", type: "submit", onClick: (e) => { if (this.props.custom_button_handler)
|
|
503
507
|
this.props.custom_button_handler(this.state.form);
|
|
504
508
|
else
|
|
505
509
|
console.error("custom_button_handler unset !"); }, children: this.props.custom_button_caption }) }), this.props.custom_button_caption2 &&
|
|
506
|
-
_jsx(ReactstrapCol, { xs:
|
|
510
|
+
_jsx(ReactstrapCol, { xs: (_e = this.props.col_xs) !== null && _e !== void 0 ? _e : 12, sm: (_f = this.props.col_sm) !== null && _f !== void 0 ? _f : 12, md: (_g = this.props.col_md) !== null && _g !== void 0 ? _g : 6, lg: (_h = this.props.col_lg) !== null && _h !== void 0 ? _h : 4, children: _jsx(Button, { id: "dsdf_custom_button2", block: true, className: "btn-round", color: "primary", type: "submit", onClick: (e) => { if (this.props.custom_button_handler2)
|
|
507
511
|
this.props.custom_button_handler2(this.state.form);
|
|
508
512
|
else
|
|
509
513
|
console.error("custom_button_handler2 unset !"); }, children: this.props.custom_button_caption2 }) })] })] }));
|
|
@@ -97,6 +97,10 @@ interface DsDynamicFormProps {
|
|
|
97
97
|
custom_button_handler2?: (form: Form) => void;
|
|
98
98
|
show_hidden?: boolean;
|
|
99
99
|
active_page?: number;
|
|
100
|
+
col_xs?: number | string;
|
|
101
|
+
col_sm?: number | string;
|
|
102
|
+
col_md?: number | string;
|
|
103
|
+
col_lg?: number | string;
|
|
100
104
|
}
|
|
101
105
|
interface DsDynamicFormState {
|
|
102
106
|
form: Form;
|
package/package.json
CHANGED