@bigbinary/neeto-fields-frontend 1.3.28 → 1.3.30
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/README.md +22 -22
- package/dist/index.cjs.js +61 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +122 -87
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Checkbox as Checkbox$1, TimePicker, DatePicker, Input, Select as Select
|
|
|
4
4
|
import { isNotEmpty, renameKeys, capitalize, findBy, noop as noop$1, filterBy, toLabelAndValue, slugify, humanize, countBy, isPresent } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { values, isNotNil, isNil, isEmpty, prop, pluck, clone, pipe, mergeAll, omit, map, pick, assoc, not, any, head } from 'ramda';
|
|
6
6
|
import { useFormikContext, useField, FieldArray } from 'formik';
|
|
7
|
-
import { t } from 'i18next';
|
|
7
|
+
import { t as t$1 } from 'i18next';
|
|
8
8
|
import * as yup from 'yup';
|
|
9
9
|
import { Select, Button, ActionBlock as ActionBlock$1, Input as Input$1, Switch, Form } from '@bigbinary/neetoui/formik';
|
|
10
10
|
import { joinHyphenCase, buildUrl, getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
|
|
@@ -589,23 +589,23 @@ var KINDS = {
|
|
|
589
589
|
datetime: "datetime"
|
|
590
590
|
};
|
|
591
591
|
var DISPLAY_KINDS = {
|
|
592
|
-
text: t("neetoFields.fields.kinds.text"),
|
|
593
|
-
number: t("neetoFields.fields.kinds.number"),
|
|
594
|
-
monetary: t("neetoFields.fields.kinds.monetary"),
|
|
595
|
-
single_option: t("neetoFields.fields.kinds.singleOption"),
|
|
596
|
-
multi_option: t("neetoFields.fields.kinds.multiOption"),
|
|
597
|
-
date: t("neetoFields.fields.kinds.date"),
|
|
598
|
-
time: t("neetoFields.fields.kinds.time"),
|
|
599
|
-
date_range: t("neetoFields.fields.kinds.dateRange"),
|
|
600
|
-
time_range: t("neetoFields.fields.kinds.timeRange"),
|
|
601
|
-
textarea: t("neetoFields.fields.kinds.textarea"),
|
|
602
|
-
text_area: t("neetoFields.fields.kinds.textArea"),
|
|
603
|
-
person: t("neetoFields.fields.kinds.person"),
|
|
604
|
-
checkbox: t("neetoFields.fields.kinds.checkbox"),
|
|
605
|
-
regex: t("neetoFields.fields.kinds.regex"),
|
|
606
|
-
integer: t("neetoFields.fields.kinds.integer"),
|
|
607
|
-
decimal: t("neetoFields.fields.kinds.decimal"),
|
|
608
|
-
datetime: t("neetoFields.fields.kinds.datetime")
|
|
592
|
+
text: t$1("neetoFields.fields.kinds.text"),
|
|
593
|
+
number: t$1("neetoFields.fields.kinds.number"),
|
|
594
|
+
monetary: t$1("neetoFields.fields.kinds.monetary"),
|
|
595
|
+
single_option: t$1("neetoFields.fields.kinds.singleOption"),
|
|
596
|
+
multi_option: t$1("neetoFields.fields.kinds.multiOption"),
|
|
597
|
+
date: t$1("neetoFields.fields.kinds.date"),
|
|
598
|
+
time: t$1("neetoFields.fields.kinds.time"),
|
|
599
|
+
date_range: t$1("neetoFields.fields.kinds.dateRange"),
|
|
600
|
+
time_range: t$1("neetoFields.fields.kinds.timeRange"),
|
|
601
|
+
textarea: t$1("neetoFields.fields.kinds.textarea"),
|
|
602
|
+
text_area: t$1("neetoFields.fields.kinds.textArea"),
|
|
603
|
+
person: t$1("neetoFields.fields.kinds.person"),
|
|
604
|
+
checkbox: t$1("neetoFields.fields.kinds.checkbox"),
|
|
605
|
+
regex: t$1("neetoFields.fields.kinds.regex"),
|
|
606
|
+
integer: t$1("neetoFields.fields.kinds.integer"),
|
|
607
|
+
decimal: t$1("neetoFields.fields.kinds.decimal"),
|
|
608
|
+
datetime: t$1("neetoFields.fields.kinds.datetime")
|
|
609
609
|
};
|
|
610
610
|
var FIELD_STATES = {
|
|
611
611
|
active: "active",
|
|
@@ -670,7 +670,7 @@ var buildSchemaForRequiredInputs = function buildSchemaForRequiredInputs(schema,
|
|
|
670
670
|
name: "validate-required-inputs",
|
|
671
671
|
test: function test(value) {
|
|
672
672
|
if (isNil(value) || isValueEmpty(value) || isArrayEmpty(kind, value) || isCheckboxUnchecked(kind, value)) {
|
|
673
|
-
throw new yup.ValidationError(t("neetoFields.validations.thisIsRequired"));
|
|
673
|
+
throw new yup.ValidationError(t$1("neetoFields.validations.thisIsRequired"));
|
|
674
674
|
}
|
|
675
675
|
schema.validateSync(value);
|
|
676
676
|
return true;
|
|
@@ -697,11 +697,11 @@ var getBasicValidationSchema = function getBasicValidationSchema(_ref2) {
|
|
|
697
697
|
case KINDS.monetary:
|
|
698
698
|
case KINDS.decimal:
|
|
699
699
|
{
|
|
700
|
-
return yup.number(t("neetoFields.validations.notAValidNumber")).nullable();
|
|
700
|
+
return yup.number(t$1("neetoFields.validations.notAValidNumber")).nullable();
|
|
701
701
|
}
|
|
702
702
|
case KINDS.integer:
|
|
703
703
|
{
|
|
704
|
-
return yup.number().nullable().integer(t("neetoFields.validations.notAValidInteger"));
|
|
704
|
+
return yup.number().nullable().integer(t$1("neetoFields.validations.notAValidInteger"));
|
|
705
705
|
}
|
|
706
706
|
case KINDS.date:
|
|
707
707
|
case KINDS.time:
|
|
@@ -786,7 +786,7 @@ var dateTimeToString = function dateTimeToString(dateTime) {
|
|
|
786
786
|
return dateTime && dayjs(dateTime).toString() || "";
|
|
787
787
|
};
|
|
788
788
|
var getValueFromBool = function getValueFromBool(value) {
|
|
789
|
-
return value === true ? t("neetoFields.common.yes") : t("neetoFields.common.no");
|
|
789
|
+
return value === true ? t$1("neetoFields.common.yes") : t$1("neetoFields.common.no");
|
|
790
790
|
};
|
|
791
791
|
|
|
792
792
|
var _excluded$7 = ["name", "id", "kind", "data", "individualSubmit", "formRef", "formRefs", "disabled", "isRequiredColumnName", "isInline", "onBlur"];
|
|
@@ -1082,23 +1082,34 @@ var Text = function Text(props) {
|
|
|
1082
1082
|
handleSubmit = _useFormikFields.handleSubmit,
|
|
1083
1083
|
fieldProps = _useFormikFields.fieldProps,
|
|
1084
1084
|
dirty = _useFormikFields.dirty;
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1085
|
+
var isInline = props.isInline;
|
|
1086
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
1087
|
+
if (event.key !== "Enter" || event.shiftKey) return;
|
|
1088
|
+
event.preventDefault();
|
|
1089
|
+
handleSubmit();
|
|
1090
|
+
};
|
|
1091
|
+
var handleFocus = function handleFocus(element) {
|
|
1092
|
+
var end = element.value.length;
|
|
1093
|
+
element.setSelectionRange(end, end);
|
|
1094
|
+
};
|
|
1095
|
+
return /*#__PURE__*/React.createElement(Textarea, _extends({}, fieldProps, {
|
|
1096
|
+
className: "neeto-fields-nano-adaptive-input",
|
|
1097
|
+
rows: 1,
|
|
1098
|
+
size: "small",
|
|
1099
|
+
style: {
|
|
1100
|
+
resize: "none"
|
|
1101
|
+
}
|
|
1102
|
+
// Inline inputs are already saved on blur and this could override that onBlur handler if this condition is not added.
|
|
1103
|
+
}, !isInline && {
|
|
1090
1104
|
onBlur: function onBlur() {
|
|
1091
1105
|
return dirty && handleSubmit();
|
|
1092
1106
|
}
|
|
1093
1107
|
}, {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
return handleSubmit();
|
|
1100
|
-
}
|
|
1101
|
-
})
|
|
1108
|
+
onFocus: function onFocus(_ref) {
|
|
1109
|
+
var target = _ref.target;
|
|
1110
|
+
return handleFocus(target);
|
|
1111
|
+
},
|
|
1112
|
+
onKeyDown: handleKeyDown
|
|
1102
1113
|
}));
|
|
1103
1114
|
};
|
|
1104
1115
|
|
|
@@ -1478,7 +1489,7 @@ var renderFormFooter = function renderFormFooter(_ref3) {
|
|
|
1478
1489
|
disabled: loading
|
|
1479
1490
|
},
|
|
1480
1491
|
submitButtonProps: {
|
|
1481
|
-
label: t("neetoFields.labels.saveChanges"),
|
|
1492
|
+
label: t$1("neetoFields.labels.saveChanges"),
|
|
1482
1493
|
className: "mr-2",
|
|
1483
1494
|
type: "submit",
|
|
1484
1495
|
disabled: !dirty,
|
|
@@ -1497,15 +1508,15 @@ var getDefaultOption = function getDefaultOption() {
|
|
|
1497
1508
|
var PERMITTED_REGEX_PATTERN = /^\/.*\/[igmsyu]*$/;
|
|
1498
1509
|
var ADVANCED_REGEX_ASSERTION_PATTERN = /\(\?=[^)]*\)|\(\?![^)]*\)|\(\?<=[^)]*\)|\(\?<![^)]*\)/;
|
|
1499
1510
|
var regexValidationSchema = yup.object().shape({
|
|
1500
|
-
condition: yup.string().required(t("neetoFields.validations.regexConditionIsRequired")).matches(PERMITTED_REGEX_PATTERN, t("neetoFields.validations.invalidRegexPattern")).test({
|
|
1511
|
+
condition: yup.string().required(t$1("neetoFields.validations.regexConditionIsRequired")).matches(PERMITTED_REGEX_PATTERN, t$1("neetoFields.validations.invalidRegexPattern")).test({
|
|
1501
1512
|
name: "test-regex-is-advanced",
|
|
1502
|
-
message: t("neetoFields.validations.advancedRegexAssertionsNotSupported") || "",
|
|
1513
|
+
message: t$1("neetoFields.validations.advancedRegexAssertionsNotSupported") || "",
|
|
1503
1514
|
test: function test(value) {
|
|
1504
1515
|
return !ADVANCED_REGEX_ASSERTION_PATTERN.test(value);
|
|
1505
1516
|
}
|
|
1506
1517
|
}).test({
|
|
1507
1518
|
name: "test-regex-condition-pattern",
|
|
1508
|
-
message: t("neetoFields.validations.invalidRegexPattern") || "",
|
|
1519
|
+
message: t$1("neetoFields.validations.invalidRegexPattern") || "",
|
|
1509
1520
|
test: function test(value) {
|
|
1510
1521
|
try {
|
|
1511
1522
|
var lastIndex = value.lastIndexOf("/");
|
|
@@ -1519,96 +1530,96 @@ var regexValidationSchema = yup.object().shape({
|
|
|
1519
1530
|
}
|
|
1520
1531
|
}
|
|
1521
1532
|
}),
|
|
1522
|
-
helpMessage: yup.string().required(t("neetoFields.validations.regexHelpMessageIsRequired"))
|
|
1533
|
+
helpMessage: yup.string().required(t$1("neetoFields.validations.regexHelpMessageIsRequired"))
|
|
1523
1534
|
});
|
|
1524
1535
|
var dropDownOptionsValidationSchema = yup.array().of(yup.object().shape({
|
|
1525
|
-
label: yup.string().trim().required(t("neetoFields.validations.fieldOptionIsRequired")),
|
|
1536
|
+
label: yup.string().trim().required(t$1("neetoFields.validations.fieldOptionIsRequired")),
|
|
1526
1537
|
displayOrder: yup.number()
|
|
1527
|
-
})).min(1, t("neetoFields.validations.atLeastFieldOptionIsRequired"));
|
|
1538
|
+
})).min(1, t$1("neetoFields.validations.atLeastFieldOptionIsRequired"));
|
|
1528
1539
|
var FIELD_KINDS = {
|
|
1529
1540
|
text: {
|
|
1530
1541
|
value: "text",
|
|
1531
|
-
label: t("neetoFields.fields.kinds.text"),
|
|
1542
|
+
label: t$1("neetoFields.fields.kinds.text"),
|
|
1532
1543
|
group: 1
|
|
1533
1544
|
},
|
|
1534
1545
|
number: {
|
|
1535
1546
|
value: "number",
|
|
1536
|
-
label: t("neetoFields.fields.kinds.number"),
|
|
1547
|
+
label: t$1("neetoFields.fields.kinds.number"),
|
|
1537
1548
|
group: 2
|
|
1538
1549
|
},
|
|
1539
1550
|
monetary: {
|
|
1540
1551
|
value: "monetary",
|
|
1541
|
-
label: t("neetoFields.fields.kinds.monetary"),
|
|
1552
|
+
label: t$1("neetoFields.fields.kinds.monetary"),
|
|
1542
1553
|
group: 2
|
|
1543
1554
|
},
|
|
1544
1555
|
single_option: {
|
|
1545
1556
|
value: "single_option",
|
|
1546
|
-
label: t("neetoFields.fields.kinds.singleOption"),
|
|
1557
|
+
label: t$1("neetoFields.fields.kinds.singleOption"),
|
|
1547
1558
|
group: 12
|
|
1548
1559
|
},
|
|
1549
1560
|
multi_option: {
|
|
1550
1561
|
value: "multi_option",
|
|
1551
|
-
label: t("neetoFields.fields.kinds.multiOption"),
|
|
1562
|
+
label: t$1("neetoFields.fields.kinds.multiOption"),
|
|
1552
1563
|
group: 3
|
|
1553
1564
|
},
|
|
1554
1565
|
date: {
|
|
1555
1566
|
value: "date",
|
|
1556
|
-
label: t("neetoFields.fields.kinds.date"),
|
|
1567
|
+
label: t$1("neetoFields.fields.kinds.date"),
|
|
1557
1568
|
group: 4
|
|
1558
1569
|
},
|
|
1559
1570
|
time: {
|
|
1560
1571
|
value: "time",
|
|
1561
|
-
label: t("neetoFields.fields.kinds.time"),
|
|
1572
|
+
label: t$1("neetoFields.fields.kinds.time"),
|
|
1562
1573
|
group: 5
|
|
1563
1574
|
},
|
|
1564
1575
|
date_range: {
|
|
1565
1576
|
value: "date_range",
|
|
1566
|
-
label: t("neetoFields.fields.kinds.dateRange"),
|
|
1577
|
+
label: t$1("neetoFields.fields.kinds.dateRange"),
|
|
1567
1578
|
group: 6
|
|
1568
1579
|
},
|
|
1569
1580
|
time_range: {
|
|
1570
1581
|
value: "time_range",
|
|
1571
|
-
label: t("neetoFields.fields.kinds.timeRange"),
|
|
1582
|
+
label: t$1("neetoFields.fields.kinds.timeRange"),
|
|
1572
1583
|
group: 7
|
|
1573
1584
|
},
|
|
1574
1585
|
text_area: {
|
|
1575
1586
|
value: "text_area",
|
|
1576
|
-
label: t("neetoFields.fields.kinds.textArea"),
|
|
1587
|
+
label: t$1("neetoFields.fields.kinds.textArea"),
|
|
1577
1588
|
group: 1
|
|
1578
1589
|
},
|
|
1579
1590
|
textarea: {
|
|
1580
1591
|
value: "textarea",
|
|
1581
|
-
label: t("neetoFields.fields.kinds.textarea"),
|
|
1592
|
+
label: t$1("neetoFields.fields.kinds.textarea"),
|
|
1582
1593
|
group: 1
|
|
1583
1594
|
},
|
|
1584
1595
|
person: {
|
|
1585
1596
|
value: "person",
|
|
1586
|
-
label: t("neetoFields.fields.kinds.person"),
|
|
1597
|
+
label: t$1("neetoFields.fields.kinds.person"),
|
|
1587
1598
|
group: 8
|
|
1588
1599
|
},
|
|
1589
1600
|
checkbox: {
|
|
1590
1601
|
value: "checkbox",
|
|
1591
|
-
label: t("neetoFields.fields.kinds.checkbox"),
|
|
1602
|
+
label: t$1("neetoFields.fields.kinds.checkbox"),
|
|
1592
1603
|
group: 9
|
|
1593
1604
|
},
|
|
1594
1605
|
regex: {
|
|
1595
1606
|
value: "regex",
|
|
1596
|
-
label: t("neetoFields.fields.kinds.regex"),
|
|
1607
|
+
label: t$1("neetoFields.fields.kinds.regex"),
|
|
1597
1608
|
group: 10
|
|
1598
1609
|
},
|
|
1599
1610
|
integer: {
|
|
1600
1611
|
value: "integer",
|
|
1601
|
-
label: t("neetoFields.fields.kinds.integer"),
|
|
1612
|
+
label: t$1("neetoFields.fields.kinds.integer"),
|
|
1602
1613
|
group: 2
|
|
1603
1614
|
},
|
|
1604
1615
|
decimal: {
|
|
1605
1616
|
value: "decimal",
|
|
1606
|
-
label: t("neetoFields.fields.kinds.decimal"),
|
|
1617
|
+
label: t$1("neetoFields.fields.kinds.decimal"),
|
|
1607
1618
|
group: 2
|
|
1608
1619
|
},
|
|
1609
1620
|
datetime: {
|
|
1610
1621
|
value: "datetime",
|
|
1611
|
-
label: t("neetoFields.fields.kinds.datetime"),
|
|
1622
|
+
label: t$1("neetoFields.fields.kinds.datetime"),
|
|
1612
1623
|
group: 11
|
|
1613
1624
|
}
|
|
1614
1625
|
};
|
|
@@ -1623,11 +1634,11 @@ var DEFAULT_REGEX_DATA = {
|
|
|
1623
1634
|
helpMessage: ""
|
|
1624
1635
|
};
|
|
1625
1636
|
var BASIC_FIELD_FORM_VALIDATIONS = {
|
|
1626
|
-
name: yup.string().trim().required(t("neetoFields.validations.fieldNameIsRequired")),
|
|
1637
|
+
name: yup.string().trim().required(t$1("neetoFields.validations.fieldNameIsRequired")),
|
|
1627
1638
|
isRequired: yup["boolean"](),
|
|
1628
1639
|
kind: yup.object().shape({
|
|
1629
1640
|
value: yup.string().required()
|
|
1630
|
-
}).required(t("neetoFields.validations.kindIsRequired")),
|
|
1641
|
+
}).required(t$1("neetoFields.validations.kindIsRequired")),
|
|
1631
1642
|
data: yup.mixed().when("kind", {
|
|
1632
1643
|
is: function is(kind) {
|
|
1633
1644
|
return isRegex(kind === null || kind === void 0 ? void 0 : kind.value);
|
|
@@ -2462,14 +2473,14 @@ var getMenuItems = function getMenuItems(_ref) {
|
|
|
2462
2473
|
return [{
|
|
2463
2474
|
key: MENU_ITEMS.EDIT,
|
|
2464
2475
|
"data-cy": "edit-menu-item-button",
|
|
2465
|
-
label: t("neetoFields.labels.edit"),
|
|
2476
|
+
label: t$1("neetoFields.labels.edit"),
|
|
2466
2477
|
onClick: function onClick() {
|
|
2467
2478
|
return onEditClick(field);
|
|
2468
2479
|
}
|
|
2469
2480
|
}, {
|
|
2470
2481
|
key: MENU_ITEMS.DELETE,
|
|
2471
2482
|
"data-cy": "delete-menu-item-button",
|
|
2472
|
-
label: t("neetoFields.labels.delete"),
|
|
2483
|
+
label: t$1("neetoFields.labels.delete"),
|
|
2473
2484
|
isVisible: not(field.isSystem),
|
|
2474
2485
|
onClick: function onClick() {
|
|
2475
2486
|
return onDeleteClick(field);
|
|
@@ -2482,7 +2493,7 @@ var buildDefaultColumns = function buildDefaultColumns(_ref2) {
|
|
|
2482
2493
|
return [{
|
|
2483
2494
|
key: "name",
|
|
2484
2495
|
dataIndex: "name",
|
|
2485
|
-
title: t("neetoFields.titles.fieldName"),
|
|
2496
|
+
title: t$1("neetoFields.titles.fieldName"),
|
|
2486
2497
|
width: 300,
|
|
2487
2498
|
render: function render(name, field) {
|
|
2488
2499
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -2507,7 +2518,7 @@ var buildDefaultColumns = function buildDefaultColumns(_ref2) {
|
|
|
2507
2518
|
}, {
|
|
2508
2519
|
key: "kind",
|
|
2509
2520
|
dataIndex: "kind",
|
|
2510
|
-
title: t("neetoFields.titles.fieldKind"),
|
|
2521
|
+
title: t$1("neetoFields.titles.fieldKind"),
|
|
2511
2522
|
render: function render(kind) {
|
|
2512
2523
|
return DISPLAY_KINDS[kind];
|
|
2513
2524
|
},
|
|
@@ -2515,10 +2526,10 @@ var buildDefaultColumns = function buildDefaultColumns(_ref2) {
|
|
|
2515
2526
|
}, {
|
|
2516
2527
|
key: "isRequired",
|
|
2517
2528
|
dataIndex: "isRequired",
|
|
2518
|
-
title: t("neetoFields.titles.required"),
|
|
2529
|
+
title: t$1("neetoFields.titles.required"),
|
|
2519
2530
|
width: 140,
|
|
2520
2531
|
render: function render(boolVal) {
|
|
2521
|
-
return boolVal ? t("neetoFields.common.yes") : t("neetoFields.common.no");
|
|
2532
|
+
return boolVal ? t$1("neetoFields.common.yes") : t$1("neetoFields.common.no");
|
|
2522
2533
|
}
|
|
2523
2534
|
}];
|
|
2524
2535
|
};
|
|
@@ -2537,7 +2548,7 @@ var renderMenuBarItems = function renderMenuBarItems(_ref3) {
|
|
|
2537
2548
|
"data-cy": "menubar-".concat(slugify(item.name), "-menu-item"),
|
|
2538
2549
|
key: item.id,
|
|
2539
2550
|
label: humanize(item.name),
|
|
2540
|
-
description: t("neetoFields.messages.manageTitleForResource", {
|
|
2551
|
+
description: t$1("neetoFields.messages.manageTitleForResource", {
|
|
2541
2552
|
title: title,
|
|
2542
2553
|
resource: humanize(item.name)
|
|
2543
2554
|
}),
|
|
@@ -2556,7 +2567,7 @@ var renderMenuBarItems = function renderMenuBarItems(_ref3) {
|
|
|
2556
2567
|
"data-cy": "neeto-fields-".concat(slugify(itemLabel), "-menu-item"),
|
|
2557
2568
|
key: label,
|
|
2558
2569
|
label: itemLabel,
|
|
2559
|
-
description: t("neetoFields.messages.manageTitleForResource", {
|
|
2570
|
+
description: t$1("neetoFields.messages.manageTitleForResource", {
|
|
2560
2571
|
title: title,
|
|
2561
2572
|
resource: itemLabel
|
|
2562
2573
|
}),
|
|
@@ -2609,7 +2620,7 @@ var getDashBoardTitle = function getDashBoardTitle(_ref7) {
|
|
|
2609
2620
|
var resourceName = _ref7.resourceName,
|
|
2610
2621
|
isSingleResource = _ref7.isSingleResource,
|
|
2611
2622
|
title = _ref7.title;
|
|
2612
|
-
var displayTitle = isSingleResource ? title : t("neetoFields.messages.titleForResource", {
|
|
2623
|
+
var displayTitle = isSingleResource ? title : t$1("neetoFields.messages.titleForResource", {
|
|
2613
2624
|
title: title,
|
|
2614
2625
|
resource: resourceName
|
|
2615
2626
|
});
|
|
@@ -7723,10 +7734,10 @@ const useNavPrompt = ({
|
|
|
7723
7734
|
};
|
|
7724
7735
|
|
|
7725
7736
|
var DEAFULT_BLOCK_NAVIGATION_ALERT_PROPS = {
|
|
7726
|
-
title: t("neetoFields.messages.blockNavigationAlert.title"),
|
|
7727
|
-
message: t("neetoFields.messages.blockNavigationAlert.message"),
|
|
7728
|
-
submitButtonLabel: t("neetoFields.messages.blockNavigationAlert.submitButtonLabel"),
|
|
7729
|
-
cancelButtonLabel: t("neetoFields.messages.blockNavigationAlert.cancelButtonLabel")
|
|
7737
|
+
title: t$1("neetoFields.messages.blockNavigationAlert.title"),
|
|
7738
|
+
message: t$1("neetoFields.messages.blockNavigationAlert.message"),
|
|
7739
|
+
submitButtonLabel: t$1("neetoFields.messages.blockNavigationAlert.submitButtonLabel"),
|
|
7740
|
+
cancelButtonLabel: t$1("neetoFields.messages.blockNavigationAlert.cancelButtonLabel")
|
|
7730
7741
|
};
|
|
7731
7742
|
|
|
7732
7743
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -7909,17 +7920,25 @@ var renderDataAsText = function renderDataAsText(field, fieldValues) {
|
|
|
7909
7920
|
|
|
7910
7921
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7911
7922
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7912
|
-
var
|
|
7913
|
-
var
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
+
var DefaultDisplayComponent = function DefaultDisplayComponent(_ref) {
|
|
7924
|
+
var value = _ref.value;
|
|
7925
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
7926
|
+
className: "text-wrap"
|
|
7927
|
+
}, value);
|
|
7928
|
+
};
|
|
7929
|
+
var InlineFieldValueInput = function InlineFieldValueInput(_ref2) {
|
|
7930
|
+
var field = _ref2.field,
|
|
7931
|
+
fieldValues = _ref2.fieldValues,
|
|
7932
|
+
resourceType = _ref2.resourceType,
|
|
7933
|
+
resourceId = _ref2.resourceId,
|
|
7934
|
+
_ref2$ownerId = _ref2.ownerId,
|
|
7935
|
+
ownerId = _ref2$ownerId === void 0 ? "" : _ref2$ownerId,
|
|
7936
|
+
_ref2$onMutationSucce = _ref2.onMutationSuccess,
|
|
7937
|
+
onMutationSuccess = _ref2$onMutationSucce === void 0 ? noop$1 : _ref2$onMutationSucce,
|
|
7938
|
+
_ref2$onMutate = _ref2.onMutate,
|
|
7939
|
+
_onMutate = _ref2$onMutate === void 0 ? noop$1 : _ref2$onMutate,
|
|
7940
|
+
_ref2$customDisplayCo = _ref2.customDisplayComponents,
|
|
7941
|
+
customDisplayComponents = _ref2$customDisplayCo === void 0 ? {} : _ref2$customDisplayCo;
|
|
7923
7942
|
var _useState = useState(false),
|
|
7924
7943
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7925
7944
|
editMode = _useState2[0],
|
|
@@ -7943,7 +7962,15 @@ var InlineFieldValueInput = function InlineFieldValueInput(_ref) {
|
|
|
7943
7962
|
var Field = getFieldInput({
|
|
7944
7963
|
field: field
|
|
7945
7964
|
});
|
|
7946
|
-
var
|
|
7965
|
+
var fieldKind = field.kind;
|
|
7966
|
+
var isEditable = !field.isSystem && (editMode || DIRECT_EDIT_INPUT_FIELDS.includes(fieldKind));
|
|
7967
|
+
var displayValue = renderDataAsText(field, fieldValues) || "-";
|
|
7968
|
+
var _ref3 = customDisplayComponents[fieldKind] || {},
|
|
7969
|
+
_ref3$props = _ref3.props,
|
|
7970
|
+
customDisplayComponentProps = _ref3$props === void 0 ? {} : _ref3$props,
|
|
7971
|
+
_ref3$component = _ref3.component,
|
|
7972
|
+
CustomDisplayComponent = _ref3$component === void 0 ? null : _ref3$component;
|
|
7973
|
+
var DisplayComponent = CustomDisplayComponent || DefaultDisplayComponent;
|
|
7947
7974
|
return isEditable ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FieldValueInputWrapper, {
|
|
7948
7975
|
field: field,
|
|
7949
7976
|
fieldValues: fieldValues,
|
|
@@ -7963,8 +7990,16 @@ var InlineFieldValueInput = function InlineFieldValueInput(_ref) {
|
|
|
7963
7990
|
onClick: function onClick() {
|
|
7964
7991
|
return setEditMode(true);
|
|
7965
7992
|
}
|
|
7966
|
-
}, /*#__PURE__*/React.createElement(
|
|
7993
|
+
}, /*#__PURE__*/React.createElement(DisplayComponent, _extends({
|
|
7994
|
+
resourceId: resourceId,
|
|
7995
|
+
value: displayValue
|
|
7996
|
+
}, customDisplayComponentProps)));
|
|
7967
7997
|
};
|
|
7968
7998
|
|
|
7999
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
8000
|
+
|
|
8001
|
+
var css = ".neeto-fields-nano-adaptive-input textarea{--neeto-ui-input-line-height:1.5}.neeto-fields-nano-adaptive-input .neeto-ui-input.neeto-ui-input--small{--neeto-ui-textarea-padding-x:8px;--neeto-ui-textarea-padding-y:4px}.neeto-fields-nano-adaptive-input .neeto-ui-input.neeto-ui-input--medium{--neeto-ui-textarea-padding-x:8px;--neeto-ui-textarea-padding-y:5px}.neeto-fields-nano-adaptive-input .neeto-ui-input.neeto-ui-input--large{--neeto-ui-textarea-padding-x:12px;--neeto-ui-textarea-padding-y:8px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX2FkYXB0aXZlX2lucHV0LnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zdHlsZXNoZWV0cy9hcHBsaWNhdGlvbi5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNFLDJDQUNFLGdDQ0FKLENESUksd0VBQ0UsaUNBQUEsQ0FDQSxpQ0NGTixDREtJLHlFQUNFLGlDQUFBLENBQ0EsaUNDSE4sQ0RNSSx3RUFDRSxrQ0FBQSxDQUNBLGlDQ0pOIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLWZpZWxkcy1uYW5vLWFkYXB0aXZlLWlucHV0IHtcbiAgdGV4dGFyZWEge1xuICAgIC0tbmVldG8tdWktaW5wdXQtbGluZS1oZWlnaHQ6IDEuNTtcbiAgfVxuXG4gIC5uZWV0by11aS1pbnB1dCAge1xuICAgICYubmVldG8tdWktaW5wdXQtLXNtYWxsIHtcbiAgICAgIC0tbmVldG8tdWktdGV4dGFyZWEtcGFkZGluZy14OiA4cHg7XG4gICAgICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteTogNHB4O1xuICAgIH1cblxuICAgICYubmVldG8tdWktaW5wdXQtLW1lZGl1bSB7XG4gICAgICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteDogOHB4O1xuICAgICAgLS1uZWV0by11aS10ZXh0YXJlYS1wYWRkaW5nLXk6IDVweDtcbiAgICB9XG5cbiAgICAmLm5lZXRvLXVpLWlucHV0LS1sYXJnZSB7XG4gICAgICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteDogMTJweDtcbiAgICAgIC0tbmVldG8tdWktdGV4dGFyZWEtcGFkZGluZy15OiA4cHg7XG4gICAgfVxuICB9XG59XG4iLCIubmVldG8tZmllbGRzLW5hbm8tYWRhcHRpdmUtaW5wdXQgdGV4dGFyZWEge1xuICAtLW5lZXRvLXVpLWlucHV0LWxpbmUtaGVpZ2h0OiAxLjU7XG59XG4ubmVldG8tZmllbGRzLW5hbm8tYWRhcHRpdmUtaW5wdXQgLm5lZXRvLXVpLWlucHV0Lm5lZXRvLXVpLWlucHV0LS1zbWFsbCB7XG4gIC0tbmVldG8tdWktdGV4dGFyZWEtcGFkZGluZy14OiA4cHg7XG4gIC0tbmVldG8tdWktdGV4dGFyZWEtcGFkZGluZy15OiA0cHg7XG59XG4ubmVldG8tZmllbGRzLW5hbm8tYWRhcHRpdmUtaW5wdXQgLm5lZXRvLXVpLWlucHV0Lm5lZXRvLXVpLWlucHV0LS1tZWRpdW0ge1xuICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteDogOHB4O1xuICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteTogNXB4O1xufVxuLm5lZXRvLWZpZWxkcy1uYW5vLWFkYXB0aXZlLWlucHV0IC5uZWV0by11aS1pbnB1dC5uZWV0by11aS1pbnB1dC0tbGFyZ2Uge1xuICAtLW5lZXRvLXVpLXRleHRhcmVhLXBhZGRpbmcteDogMTJweDtcbiAgLS1uZWV0by11aS10ZXh0YXJlYS1wYWRkaW5nLXk6IDhweDtcbn0iXX0= */";
|
|
8002
|
+
n(css,{});
|
|
8003
|
+
|
|
7969
8004
|
export { DeleteAlert as FieldDeleteAlert, FieldInputs, FieldValuesContainer, FieldsDashboard, FieldsPane, InlineFieldValueInput, neetoFieldsUtils, useCreateField, useDestroyField, useFetchFields, useShowField, useUpdateField };
|
|
7970
8005
|
//# sourceMappingURL=index.js.map
|