@torq-north/react-tools 1.4.2 → 1.4.3
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/index.cjs +40 -240
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +40 -240
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -388,154 +388,6 @@ function FieldWrapper(_a) {
|
|
|
388
388
|
return (jsxRuntime.jsxs(material.Stack, { direction: "row", alignItems: "center", children: [(icon || showSpace) && (jsxRuntime.jsx(material.Box, { minWidth: 32, color: "primary.main", mt: 2, mx: 1, children: icon })), children] }));
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
function getDefaultExportFromCjs (x) {
|
|
392
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
var cjs;
|
|
396
|
-
var hasRequiredCjs;
|
|
397
|
-
|
|
398
|
-
function requireCjs () {
|
|
399
|
-
if (hasRequiredCjs) return cjs;
|
|
400
|
-
hasRequiredCjs = 1;
|
|
401
|
-
|
|
402
|
-
var isMergeableObject = function isMergeableObject(value) {
|
|
403
|
-
return isNonNullObject(value)
|
|
404
|
-
&& !isSpecial(value)
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
function isNonNullObject(value) {
|
|
408
|
-
return !!value && typeof value === 'object'
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function isSpecial(value) {
|
|
412
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
413
|
-
|
|
414
|
-
return stringValue === '[object RegExp]'
|
|
415
|
-
|| stringValue === '[object Date]'
|
|
416
|
-
|| isReactElement(value)
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
420
|
-
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
421
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
422
|
-
|
|
423
|
-
function isReactElement(value) {
|
|
424
|
-
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function emptyTarget(val) {
|
|
428
|
-
return Array.isArray(val) ? [] : {}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
432
|
-
return (options.clone !== false && options.isMergeableObject(value))
|
|
433
|
-
? deepmerge(emptyTarget(value), value, options)
|
|
434
|
-
: value
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function defaultArrayMerge(target, source, options) {
|
|
438
|
-
return target.concat(source).map(function(element) {
|
|
439
|
-
return cloneUnlessOtherwiseSpecified(element, options)
|
|
440
|
-
})
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
function getMergeFunction(key, options) {
|
|
444
|
-
if (!options.customMerge) {
|
|
445
|
-
return deepmerge
|
|
446
|
-
}
|
|
447
|
-
var customMerge = options.customMerge(key);
|
|
448
|
-
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
452
|
-
return Object.getOwnPropertySymbols
|
|
453
|
-
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
454
|
-
return Object.propertyIsEnumerable.call(target, symbol)
|
|
455
|
-
})
|
|
456
|
-
: []
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function getKeys(target) {
|
|
460
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
function propertyIsOnObject(object, property) {
|
|
464
|
-
try {
|
|
465
|
-
return property in object
|
|
466
|
-
} catch(_) {
|
|
467
|
-
return false
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
472
|
-
function propertyIsUnsafe(target, key) {
|
|
473
|
-
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
474
|
-
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
475
|
-
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
function mergeObject(target, source, options) {
|
|
479
|
-
var destination = {};
|
|
480
|
-
if (options.isMergeableObject(target)) {
|
|
481
|
-
getKeys(target).forEach(function(key) {
|
|
482
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
getKeys(source).forEach(function(key) {
|
|
486
|
-
if (propertyIsUnsafe(target, key)) {
|
|
487
|
-
return
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
491
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
492
|
-
} else {
|
|
493
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
return destination
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
function deepmerge(target, source, options) {
|
|
500
|
-
options = options || {};
|
|
501
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
502
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
503
|
-
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
504
|
-
// implementations can use it. The caller may not replace it.
|
|
505
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
506
|
-
|
|
507
|
-
var sourceIsArray = Array.isArray(source);
|
|
508
|
-
var targetIsArray = Array.isArray(target);
|
|
509
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
510
|
-
|
|
511
|
-
if (!sourceAndTargetTypesMatch) {
|
|
512
|
-
return cloneUnlessOtherwiseSpecified(source, options)
|
|
513
|
-
} else if (sourceIsArray) {
|
|
514
|
-
return options.arrayMerge(target, source, options)
|
|
515
|
-
} else {
|
|
516
|
-
return mergeObject(target, source, options)
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
521
|
-
if (!Array.isArray(array)) {
|
|
522
|
-
throw new Error('first argument should be an array')
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return array.reduce(function(prev, next) {
|
|
526
|
-
return deepmerge(prev, next, options)
|
|
527
|
-
}, {})
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
var deepmerge_1 = deepmerge;
|
|
531
|
-
|
|
532
|
-
cjs = deepmerge_1;
|
|
533
|
-
return cjs;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
var cjsExports = requireCjs();
|
|
537
|
-
var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
|
538
|
-
|
|
539
391
|
// https://codesandbox.io/s/github/final-form/react-final-form/tree/master/examples/field-level-validation?file=/index.js:557-691
|
|
540
392
|
function composeValidators() {
|
|
541
393
|
var validators = [];
|
|
@@ -562,18 +414,12 @@ function TextFormField(_a) {
|
|
|
562
414
|
var name = _a.name, label = _a.label, required = _a.required, multiline = _a.multiline, disabled = _a.disabled, placeholder = _a.placeholder, slotProps = _a.slotProps, helperText = _a.helperText, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c;
|
|
563
415
|
var _d = reactFinalForm.useField(name, __assign({ format: format, validate: required
|
|
564
416
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _d.input, meta = _d.meta;
|
|
565
|
-
var
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
placeholder: placeholder,
|
|
572
|
-
error: meta.touched && meta.error,
|
|
573
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
574
|
-
slotProps: { input: input },
|
|
575
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {});
|
|
576
|
-
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(material.TextField, __assign({}, textFieldProps)) }));
|
|
417
|
+
var _e = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _e.slotProps, remainingTextFieldProps = __rest(_e, ["slotProps"]);
|
|
418
|
+
var inputSlotProp = textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
419
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: typeof inputSlotProp === "function"
|
|
420
|
+
? function (ownerState) { return (__assign(__assign({}, input), inputSlotProp(ownerState))); }
|
|
421
|
+
: __assign(__assign({}, input), inputSlotProp) });
|
|
422
|
+
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(material.TextField, __assign({ fullWidth: true, label: label, required: required, multiline: multiline, disabled: disabled, placeholder: placeholder, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, slotProps: mergedSlotProps }, remainingTextFieldProps)) }));
|
|
577
423
|
}
|
|
578
424
|
|
|
579
425
|
function isGroup(o) {
|
|
@@ -620,25 +466,17 @@ function SelectFormField(_a) {
|
|
|
620
466
|
var name = _a.name, label = _a.label, required = _a.required, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, isClearable = _a.isClearable, options = _a.options, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _d = _a.validators, validators = _d === void 0 ? [] : _d;
|
|
621
467
|
var _e = reactFinalForm.useField(name, __assign({ format: format, validate: required
|
|
622
468
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), _f = _e.input, value = _f.value, onChange = _f.onChange, otherInputProps = __rest(_f, ["value", "onChange"]), meta = _e.meta;
|
|
623
|
-
var
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
onChange: onChange,
|
|
633
|
-
slotProps: {
|
|
634
|
-
input: otherInputProps,
|
|
635
|
-
select: {
|
|
636
|
-
endAdornment: isClearable ? (jsxRuntime.jsx(material.Box, { pr: 2, children: jsxRuntime.jsx(material.IconButton, { size: (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _b === void 0 ? void 0 : _b.size, onClick: function () { return onChange(undefined); }, children: jsxRuntime.jsx(CloseIcon, { fontSize: "inherit" }) }) })) : undefined,
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
}, (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _c !== void 0 ? _c : {});
|
|
469
|
+
var _g = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _g.slotProps, remainingTextFieldProps = __rest(_g, ["slotProps"]);
|
|
470
|
+
// SlotProps can be an object or a callback; we only support the object form here.
|
|
471
|
+
var inputSlotProps = typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input) === "function"
|
|
472
|
+
? undefined
|
|
473
|
+
: textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
474
|
+
var hasEndAdornment = isClearable || (inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment);
|
|
475
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: __assign(__assign({}, otherInputProps), inputSlotProps), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), (hasEndAdornment && {
|
|
476
|
+
endAdornment: (jsxRuntime.jsxs(material.Stack, { direction: "row", spacing: 1, pr: 2, children: [inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment, " ", isClearable && (jsxRuntime.jsx(material.IconButton, { size: (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _c === void 0 ? void 0 : _c.size, onClick: function () { return onChange(undefined); }, children: jsxRuntime.jsx(CloseIcon, { fontSize: "inherit" }) }))] })),
|
|
477
|
+
})) });
|
|
640
478
|
var renderedOptions = React.useMemo(function () { return renderSelectOptions(options); }, [options]);
|
|
641
|
-
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsxs(material.TextField, __assign({},
|
|
479
|
+
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsxs(material.TextField, __assign({ fullWidth: true, select: true, label: label, required: required, disabled: disabled, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, value: value ? value : [], onChange: onChange, slotProps: mergedSlotProps }, remainingTextFieldProps, { children: [renderedOptions, !options && jsxRuntime.jsx(material.MenuItem, {})] })) }));
|
|
642
480
|
}
|
|
643
481
|
|
|
644
482
|
function findTextFor(value, options) {
|
|
@@ -667,29 +505,16 @@ function MultiSelectFormField(_a) {
|
|
|
667
505
|
var name = _a.name, label = _a.label, required = _a.required, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, isClearable = _a.isClearable, options = _a.options, icon = _a.icon, showSpace = _a.showSpace, format = _a.format, _d = _a.validators, validators = _d === void 0 ? [] : _d;
|
|
668
506
|
var _e = reactFinalForm.useField(name, __assign({ format: format, validate: required
|
|
669
507
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), _f = _e.input, value = _f.value, onChange = _f.onChange, otherInputProps = __rest(_f, ["value", "onChange"]), meta = _e.meta;
|
|
670
|
-
var
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
value: value ? value : [],
|
|
679
|
-
onChange: onChange,
|
|
680
|
-
slotProps: {
|
|
681
|
-
input: otherInputProps,
|
|
682
|
-
select: {
|
|
683
|
-
endAdornment: isClearable ? (jsxRuntime.jsx(material.Box, { pr: 2, children: jsxRuntime.jsx(material.IconButton, { size: (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _b === void 0 ? void 0 : _b.size, onClick: function () { return onChange([]); }, children: jsxRuntime.jsx(CloseIcon, { fontSize: "inherit" }) }) })) : undefined,
|
|
684
|
-
multiple: true,
|
|
685
|
-
renderValue: function (selected) { return (jsxRuntime.jsx(material.Box, { whiteSpace: "normal", children: selected
|
|
686
|
-
.map(function (s) { var _a; return (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"; })
|
|
687
|
-
.join(", ") })); },
|
|
688
|
-
},
|
|
689
|
-
},
|
|
690
|
-
}, (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _c !== void 0 ? _c : {});
|
|
508
|
+
var _g = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) !== null && _b !== void 0 ? _b : {}), textFieldSlotProps = _g.slotProps, remainingTextFieldProps = __rest(_g, ["slotProps"]);
|
|
509
|
+
// SlotProps can be an object or a callback; we only support the object form here.
|
|
510
|
+
var inputSlotProps = typeof (textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input) === "function"
|
|
511
|
+
? undefined
|
|
512
|
+
: textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.input;
|
|
513
|
+
var mergedSlotProps = __assign(__assign({}, textFieldSlotProps), { input: __assign(__assign({}, otherInputProps), inputSlotProps), select: __assign(__assign({}, textFieldSlotProps === null || textFieldSlotProps === void 0 ? void 0 : textFieldSlotProps.select), { endAdornment: (jsxRuntime.jsxs(material.Stack, { direction: "row", spacing: 1, pr: 2, children: [inputSlotProps === null || inputSlotProps === void 0 ? void 0 : inputSlotProps.endAdornment, " ", isClearable && (jsxRuntime.jsx(material.IconButton, { size: (_c = slotProps === null || slotProps === void 0 ? void 0 : slotProps.textField) === null || _c === void 0 ? void 0 : _c.size, onClick: function () { return onChange([]); }, children: jsxRuntime.jsx(CloseIcon, { fontSize: "inherit" }) }))] })), multiple: true, renderValue: function (selected) { return (jsxRuntime.jsx(material.Box, { whiteSpace: "normal", children: selected
|
|
514
|
+
.map(function (s) { var _a; return (_a = findTextFor(s, options)) !== null && _a !== void 0 ? _a : "Unknown"; })
|
|
515
|
+
.join(", ") })); } }) });
|
|
691
516
|
var renderedOptions = React.useMemo(function () { return renderCheckboxSelectOptions(options, value); }, [options, value]);
|
|
692
|
-
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsxs(material.TextField, __assign({},
|
|
517
|
+
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsxs(material.TextField, __assign({ fullWidth: true, select: true, label: label, required: required, disabled: disabled, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, value: value ? value : [], onChange: onChange, slotProps: mergedSlotProps }, remainingTextFieldProps, { children: [renderedOptions, !options && jsxRuntime.jsx(material.MenuItem, {})] })) }));
|
|
693
518
|
}
|
|
694
519
|
|
|
695
520
|
var mustBeChecked = function (v) {
|
|
@@ -697,11 +522,10 @@ var mustBeChecked = function (v) {
|
|
|
697
522
|
};
|
|
698
523
|
|
|
699
524
|
var CheckboxFormField = function (_a) {
|
|
700
|
-
var _b;
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
var checkboxProps = deepmerge(__assign(__assign({}, input), { disabled: disabled }), (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.checkbox) !== null && _b !== void 0 ? _b : {});
|
|
525
|
+
var name = _a.name, label = _a.label, mustBeTrue = _a.mustBeTrue, disabled = _a.disabled, helperText = _a.helperText, slotProps = _a.slotProps, icon = _a.icon, showSpace = _a.showSpace, _b = _a.validators, validators = _b === void 0 ? [] : _b, forceError = _a.forceError;
|
|
526
|
+
var _c = reactFinalForm.useField(name, __assign({ type: "checkbox", validate: mustBeTrue
|
|
527
|
+
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [mustBeChecked], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _c.input, meta = _c.meta;
|
|
528
|
+
var checkboxProps = __assign(__assign(__assign({}, input), { disabled: disabled }), slotProps === null || slotProps === void 0 ? void 0 : slotProps.checkbox);
|
|
705
529
|
return (jsxRuntime.jsxs(FieldWrapper, { icon: icon, showSpace: showSpace, children: [jsxRuntime.jsx(material.FormControlLabel, { control: jsxRuntime.jsx(material.FormGroup, { children: jsxRuntime.jsx(material.Checkbox, __assign({}, checkboxProps)) }), label: label, disabled: disabled }), ((meta.touched && meta.error) || helperText) && (jsxRuntime.jsx(material.FormHelperText, { disabled: disabled, error: (meta.touched && meta.error) || forceError, sx: { marginTop: 0, marginLeft: 2 }, children: meta.error || helperText }))] }));
|
|
706
530
|
};
|
|
707
531
|
|
|
@@ -710,25 +534,11 @@ var DateFormField = function (_a) {
|
|
|
710
534
|
var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c, _d = _a.formatAsDate, formatAsDate = _d === void 0 ? false : _d;
|
|
711
535
|
var _e = reactFinalForm.useField(name, __assign({ format: format, validate: required
|
|
712
536
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _e.input, meta = _e.meta;
|
|
713
|
-
var
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
views: ["year", "month", "day"],
|
|
717
|
-
slotProps: {
|
|
718
|
-
textField: {
|
|
719
|
-
fullWidth: true,
|
|
720
|
-
required: required,
|
|
721
|
-
color: meta.touched && meta.error ? "error" : undefined,
|
|
722
|
-
error: meta.touched && meta.error,
|
|
723
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
724
|
-
onFocus: input.onFocus,
|
|
725
|
-
onBlur: input.onBlur,
|
|
726
|
-
},
|
|
727
|
-
},
|
|
728
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {});
|
|
729
|
-
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.DatePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) {
|
|
537
|
+
var _f = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.datePicker) !== null && _b !== void 0 ? _b : {}), datePickerSlotProps = _f.slotProps, remainingDatePickerProps = __rest(_f, ["slotProps"]);
|
|
538
|
+
var mergedSlotProps = __assign(__assign({}, datePickerSlotProps), { textField: __assign({ fullWidth: true, required: required, color: meta.touched && meta.error ? "error" : undefined, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, onFocus: input.onFocus, onBlur: input.onBlur }, datePickerSlotProps === null || datePickerSlotProps === void 0 ? void 0 : datePickerSlotProps.textField) });
|
|
539
|
+
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.DatePicker, __assign({ label: label, disabled: disabled, views: ["year", "month", "day"], value: input.value ? dayjs(input.value) : null, onChange: function (value) {
|
|
730
540
|
return input.onChange(formatAsDate ? value === null || value === void 0 ? void 0 : value.format("YYYY-MM-DD") : value === null || value === void 0 ? void 0 : value.toJSON());
|
|
731
|
-
} },
|
|
541
|
+
}, slotProps: mergedSlotProps }, remainingDatePickerProps)) }));
|
|
732
542
|
};
|
|
733
543
|
|
|
734
544
|
var DateTimeFormField = function (_a) {
|
|
@@ -736,23 +546,9 @@ var DateTimeFormField = function (_a) {
|
|
|
736
546
|
var name = _a.name, label = _a.label, required = _a.required, icon = _a.icon, showSpace = _a.showSpace, slotProps = _a.slotProps, disabled = _a.disabled, helperText = _a.helperText, format = _a.format, _c = _a.validators, validators = _c === void 0 ? [] : _c;
|
|
737
547
|
var _d = reactFinalForm.useField(name, __assign({ format: format, validate: required
|
|
738
548
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)), input = _d.input, meta = _d.meta;
|
|
739
|
-
var
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
views: ["year", "month", "day"],
|
|
743
|
-
slotProps: {
|
|
744
|
-
textField: {
|
|
745
|
-
fullWidth: true,
|
|
746
|
-
required: required,
|
|
747
|
-
color: meta.touched && meta.error ? "error" : undefined,
|
|
748
|
-
error: meta.touched && meta.error,
|
|
749
|
-
helperText: (meta.touched && meta.error) || helperText,
|
|
750
|
-
onFocus: input.onFocus,
|
|
751
|
-
onBlur: input.onBlur,
|
|
752
|
-
},
|
|
753
|
-
},
|
|
754
|
-
}, (_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.dateTimePicker) !== null && _b !== void 0 ? _b : {});
|
|
755
|
-
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.DateTimePicker, __assign({ value: input.value ? dayjs(input.value) : null, onChange: function (value) { return input.onChange(value === null || value === void 0 ? void 0 : value.toJSON()); } }, dateTimeProps)) }));
|
|
549
|
+
var _e = ((_b = slotProps === null || slotProps === void 0 ? void 0 : slotProps.dateTimePicker) !== null && _b !== void 0 ? _b : {}), dateTimePickerSlotProps = _e.slotProps, remainingDateTimePickerProps = __rest(_e, ["slotProps"]);
|
|
550
|
+
var mergedSlotProps = __assign(__assign({}, dateTimePickerSlotProps), { textField: __assign({ fullWidth: true, required: required, color: meta.touched && meta.error ? "error" : undefined, error: meta.touched && meta.error, helperText: (meta.touched && meta.error) || helperText, onFocus: input.onFocus, onBlur: input.onBlur }, dateTimePickerSlotProps === null || dateTimePickerSlotProps === void 0 ? void 0 : dateTimePickerSlotProps.textField) });
|
|
551
|
+
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsx(xDatePickers.DateTimePicker, __assign({ label: label, disabled: disabled, value: input.value ? dayjs(input.value) : null, onChange: function (value) { return input.onChange(value === null || value === void 0 ? void 0 : value.toJSON()); }, slotProps: mergedSlotProps }, remainingDateTimePickerProps)) }));
|
|
756
552
|
};
|
|
757
553
|
|
|
758
554
|
//Courtesy of https://stackoverflow.com/questions/58099124/how-to-use-custom-radio-component-with-react-final-form
|
|
@@ -880,6 +676,10 @@ function FileDisplay(_a) {
|
|
|
880
676
|
return (jsxRuntime.jsx(material.Stack, { children: files.map(function (f) { return (jsxRuntime.jsx(IndividualFile, __assign({ file: f }, individualFileProps), isAsset(f) ? f.id : f.name)); }) }));
|
|
881
677
|
}
|
|
882
678
|
|
|
679
|
+
function getDefaultExportFromCjs (x) {
|
|
680
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
681
|
+
}
|
|
682
|
+
|
|
883
683
|
var propTypes = {exports: {}};
|
|
884
684
|
|
|
885
685
|
var reactIs = {exports: {}};
|