UNPKG

@react-form-fields/native-base

Version:

Native Base Form Fields

55 lines 2.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var builder_1 = require("@react-form-fields/core/ConfigProvider/builder"); var ConfigBuilder = /** @class */ (function (_super) { tslib_1.__extends(ConfigBuilder, _super); function ConfigBuilder() { return _super !== null && _super.apply(this, arguments) || this; } ConfigBuilder.prototype.setDateConfig = function (locale, pickerLocale, formats, labels) { this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { date: { dataFnsLocale: locale, pickerLocale: pickerLocale, formats: formats, labels: labels } }); return this; }; ConfigBuilder.prototype.setValidationOn = function (event) { this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { validationOn: event }); return this; }; ConfigBuilder.prototype.setItemProps = function (itemProps) { this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { itemProps: itemProps }); return this; }; ConfigBuilder.prototype.setLoadingProps = function (loadingProps, loadingStyle) { this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { loadingProps: loadingProps, loadingStyle: loadingStyle }); return this; }; ConfigBuilder.prototype.setIconProps = function (iconProps, selectIcon, selectSearchIcon, dateClearIcon) { var selectConfig = this.config.select || { icon: '', searchIcon: '' }; var dateConfig = this.config.date || { clearIcon: '' }; this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { iconProps: iconProps, select: tslib_1.__assign(tslib_1.__assign({}, selectConfig), { icon: selectIcon || selectConfig.icon, searchIcon: selectSearchIcon || selectConfig.searchIcon }), date: tslib_1.__assign(tslib_1.__assign({}, dateConfig), { clearIcon: dateClearIcon || dateConfig.clearIcon }) }); return this; }; ConfigBuilder.prototype.setLabelProps = function (labelProps) { this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), { labelProps: labelProps }); return this; }; ConfigBuilder.prototype.clean = function () { this.config = tslib_1.__assign(tslib_1.__assign({}, _super.prototype.clean.call(this)), { validationOn: 'onSubmit', date: { dataFnsLocale: null, pickerLocale: 'en-US', formats: { date: 'yyyy-MM-dd', time: 'HH:ss', datetime: 'yyyy-MM-dd HH:ss' }, labels: { ok: 'Ok', cancel: 'Cancel' } } }); return this; }; return ConfigBuilder; }(builder_1.default)); exports.default = ConfigBuilder; //# sourceMappingURL=builder.js.map