orc-shared 5.10.0-dev.2 → 5.10.0-dev.20
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/actions/metadata.js +30 -11
- package/dist/actions/requestsApi.js +10 -1
- package/dist/components/AppFrame/About.js +136 -100
- package/dist/components/AppFrame/Anchor.js +45 -21
- package/dist/components/AppFrame/AppFrame.js +53 -31
- package/dist/components/AppFrame/Help.js +35 -15
- package/dist/components/AppFrame/MenuItem.js +148 -114
- package/dist/components/AppFrame/Preferences.js +136 -97
- package/dist/components/AppFrame/Sidebar.js +51 -28
- package/dist/components/AppFrame/Topbar.js +61 -36
- package/dist/components/ColumnWrapper.js +28 -5
- package/dist/components/DropMenu/Menu.js +79 -45
- package/dist/components/DropMenu/index.js +34 -29
- package/dist/components/Form/Combination.js +45 -16
- package/dist/components/Form/Field.js +57 -38
- package/dist/components/Form/FieldElements.js +0 -11
- package/dist/components/Form/Fieldset.js +47 -19
- package/dist/components/Form/Form.js +22 -9
- package/dist/components/Form/FormElement.js +40 -7
- package/dist/components/Form/Inputs/Button.js +63 -18
- package/dist/components/Form/Inputs/ReadOnly.js +50 -27
- package/dist/components/{AppFrame/ApplicationSelector/Header.js → Form/Inputs/Selector.js} +30 -31
- package/dist/components/Form/Inputs/Text.js +20 -37
- package/dist/components/Form/Inputs/Toggles.js +39 -40
- package/dist/components/Form/Inputs/index.js +2 -13
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +31 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +89 -0
- package/dist/components/MaterialUI/DataDisplay/Table.js +109 -18
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +5 -1
- package/dist/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +198 -0
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +4 -1
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/dist/components/MaterialUI/Inputs/Select.js +2 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/dist/components/MaterialUI/Inputs/Switch.js +17 -1
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -1
- package/dist/components/MaterialUI/muiThemes.js +2 -1
- package/dist/constants.js +2 -1
- package/dist/content/iconsSheet.svg +740 -116
- package/dist/hocs/withScrollBox.js +27 -12
- package/dist/hooks/useInMemoryPaging.js +135 -0
- package/dist/hooks/useMultipleFieldEditState.js +12 -3
- package/dist/reducers/metadata.js +6 -0
- package/dist/schemas/metadata.js +9 -1
- package/dist/selectors/locale.js +1 -0
- package/dist/selectors/metadata.js +14 -11
- package/dist/sharedMessages.js +4 -0
- package/dist/utils/ListHelper.js +271 -0
- package/dist/utils/comparisonHelper.js +185 -0
- package/dist/utils/propertyBagHelper.js +3 -1
- package/package.json +1 -1
- package/src/actions/metadata.js +11 -0
- package/src/actions/metadata.test.js +27 -0
- package/src/actions/requestsApi.js +6 -0
- package/src/components/AppFrame/About.js +97 -117
- package/src/components/AppFrame/About.test.js +128 -90
- package/src/components/AppFrame/Anchor.js +34 -36
- package/src/components/AppFrame/Anchor.test.js +5 -68
- package/src/components/AppFrame/AppFrame.js +31 -40
- package/src/components/AppFrame/AppFrame.test.js +424 -445
- package/src/components/AppFrame/Help.js +23 -20
- package/src/components/AppFrame/Help.test.js +3 -3
- package/src/components/AppFrame/MenuItem.js +106 -126
- package/src/components/AppFrame/MenuItem.test.js +78 -169
- package/src/components/AppFrame/Preferences.js +110 -98
- package/src/components/AppFrame/Preferences.test.js +115 -219
- package/src/components/AppFrame/Sidebar.js +39 -41
- package/src/components/AppFrame/Sidebar.test.js +88 -168
- package/src/components/AppFrame/Topbar.js +59 -52
- package/src/components/AppFrame/Topbar.test.js +31 -39
- package/src/components/ColumnWrapper.js +18 -9
- package/src/components/DropMenu/DropMenu.test.js +185 -224
- package/src/components/DropMenu/Menu.js +73 -80
- package/src/components/DropMenu/Menu.test.js +35 -86
- package/src/components/DropMenu/index.js +19 -15
- package/src/components/Form/Combination.js +35 -28
- package/src/components/Form/Combination.test.js +6 -19
- package/src/components/Form/Field.js +53 -66
- package/src/components/Form/Field.test.js +29 -51
- package/src/components/Form/FieldElements.js +0 -14
- package/src/components/Form/FieldElements.test.js +104 -111
- package/src/components/Form/Fieldset.js +42 -37
- package/src/components/Form/Fieldset.test.js +14 -7
- package/src/components/Form/Form.js +11 -7
- package/src/components/Form/Form.test.js +75 -56
- package/src/components/Form/FormElement.js +24 -16
- package/src/components/Form/InputField.test.js +24 -30
- package/src/components/Form/Inputs/Button.js +58 -14
- package/src/components/Form/Inputs/Button.test.js +32 -7
- package/src/components/Form/Inputs/Inputs.test.js +0 -7
- package/src/components/Form/Inputs/ReadOnly.js +34 -28
- package/src/components/Form/Inputs/ReadOnly.test.js +45 -7
- package/src/components/Form/Inputs/Selector.js +22 -0
- package/src/components/Form/Inputs/Selector.test.js +105 -0
- package/src/components/Form/Inputs/Text.js +15 -44
- package/src/components/Form/Inputs/Text.test.js +20 -29
- package/src/components/Form/Inputs/Toggles.js +27 -26
- package/src/components/Form/Inputs/Toggles.test.js +22 -28
- package/src/components/Form/Inputs/index.js +4 -15
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +1 -4
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +32 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.test.js +3 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +39 -0
- package/src/components/MaterialUI/DataDisplay/Table.js +190 -114
- package/src/components/MaterialUI/DataDisplay/Table.test.js +246 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +4 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +145 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.test.js +457 -0
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +5 -1
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.test.js +7 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/src/components/MaterialUI/Inputs/Select.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/Switch.js +22 -1
- package/src/components/MaterialUI/Inputs/Switch.test.js +23 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.test.js +2 -0
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +4 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +27 -0
- package/src/components/MaterialUI/muiThemes.js +1 -0
- package/src/components/Navigation/Bar.test.js +92 -87
- package/src/components/TaskDetailsModal.test.js +1 -3
- package/src/constants.js +1 -0
- package/src/content/iconsSheet.svg +740 -116
- package/src/hocs/withScrollBox.js +32 -19
- package/src/hocs/withScrollBox.test.js +15 -3
- package/src/hooks/useInMemoryPaging.js +78 -0
- package/src/hooks/useInMemoryPaging.test.js +515 -0
- package/src/hooks/useMultipleFieldEditState.js +11 -4
- package/src/hooks/useMultipleFieldEditState.test.js +49 -1
- package/src/reducers/metadata.js +6 -1
- package/src/reducers/metadata.test.js +31 -0
- package/src/requests +1 -0
- package/src/schemas/metadata.js +3 -0
- package/src/selectors/locale.js +1 -1
- package/src/selectors/metadata.js +12 -9
- package/src/selectors/metadata.test.js +92 -11
- package/src/sharedMessages.js +4 -0
- package/src/translations/en-US.json +1 -0
- package/src/translations/fr-CA.json +1 -0
- package/src/utils/ListHelper.js +203 -0
- package/src/utils/ListHelper.test.js +710 -0
- package/src/utils/comparisonHelper.js +135 -0
- package/src/utils/comparisonHelper.test.js +334 -0
- package/src/utils/propertyBagHelper.js +2 -0
- package/src/utils/propertyBagHelper.test.js +6 -0
- package/dist/components/Form/FieldList.js +0 -270
- package/dist/components/Form/Inputs/FieldButtons.js +0 -66
- package/dist/components/Form/Inputs/Number.js +0 -117
- package/dist/components/Form/Inputs/SmallButton.js +0 -91
- package/dist/components/Form/Inputs/Time.js +0 -86
- package/dist/components/Form/Inputs/Translation.js +0 -169
- package/src/components/AppFrame/ApplicationSelector/Header.js +0 -34
- package/src/components/AppFrame/ApplicationSelector/Header.test.js +0 -23
- package/src/components/Form/FieldList.js +0 -210
- package/src/components/Form/FieldList.test.js +0 -558
- package/src/components/Form/Inputs/FieldButtons.js +0 -90
- package/src/components/Form/Inputs/Number.js +0 -60
- package/src/components/Form/Inputs/Number.test.js +0 -435
- package/src/components/Form/Inputs/SmallButton.js +0 -37
- package/src/components/Form/Inputs/SmallButton.test.js +0 -65
- package/src/components/Form/Inputs/Time.js +0 -32
- package/src/components/Form/Inputs/Time.test.js +0 -41
- package/src/components/Form/Inputs/Translation.js +0 -93
- package/src/components/Form/Inputs/Translation.test.js +0 -204
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = exports.TranslationWrapper = exports.TranslationInput = exports.TranslationField = exports.ShowButtonChevron = exports.ShowButton = exports.LanguageLabel = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _reactRedux = require("react-redux");
|
|
7
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
-
var _utils = require("../../../utils");
|
|
9
|
-
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
10
|
-
var _Text = _interopRequireDefault(require("../../Text"));
|
|
11
|
-
var _locale = require("../../../selectors/locale");
|
|
12
|
-
var _useToggle3 = _interopRequireDefault(require("../../../hooks/useToggle"));
|
|
13
|
-
var _Text2 = require("./Text");
|
|
14
|
-
var _FieldButtons = require("./FieldButtons");
|
|
15
|
-
var _excluded = ["lang", "message", "onChange", "required"],
|
|
16
|
-
_excluded2 = ["update", "value", "initShowAll", "required", "moreLabel"];
|
|
17
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
-
(function () {
|
|
21
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
22
|
-
enterModule && enterModule(module);
|
|
23
|
-
})();
|
|
24
|
-
(function () {
|
|
25
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
26
|
-
enterModule && enterModule(module);
|
|
27
|
-
})();
|
|
28
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
29
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
30
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
31
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
32
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
33
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
34
|
-
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; }
|
|
35
|
-
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; }
|
|
36
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
37
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
38
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
39
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
40
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
41
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
42
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
43
|
-
return a;
|
|
44
|
-
};
|
|
45
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
46
|
-
return a;
|
|
47
|
-
};
|
|
48
|
-
var LanguageLabel = exports.LanguageLabel = _styledComponents.default.label.withConfig({
|
|
49
|
-
displayName: "Translation__LanguageLabel",
|
|
50
|
-
componentId: "sc-1w4od1i-0"
|
|
51
|
-
})(["flex:0 0 auto;min-width:55px;border-right:1px solid ", ";padding:5px 10px;background-color:#eaeaea;margin-right:0;"], (0, _utils.getThemeProp)(["colors", "borderLight"], "#cccccc"));
|
|
52
|
-
var TranslationField = exports.TranslationField = function TranslationField(_ref) {
|
|
53
|
-
var lang = _ref.lang,
|
|
54
|
-
_ref$message = _ref.message,
|
|
55
|
-
message = _ref$message === void 0 ? "" : _ref$message,
|
|
56
|
-
onChange = _ref.onChange,
|
|
57
|
-
required = _ref.required,
|
|
58
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_FieldButtons.ButtonWrapper, {
|
|
60
|
-
invalid: required && !message
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(LanguageLabel, null, lang), /*#__PURE__*/_react.default.createElement(_Text2.FormInput, _extends({
|
|
62
|
-
value: message,
|
|
63
|
-
onChange: onChange
|
|
64
|
-
}, props)));
|
|
65
|
-
};
|
|
66
|
-
TranslationField.displayName = "TranslationField";
|
|
67
|
-
var TranslationWrapper = exports.TranslationWrapper = _styledComponents.default.div.withConfig({
|
|
68
|
-
displayName: "Translation__TranslationWrapper",
|
|
69
|
-
componentId: "sc-1w4od1i-1"
|
|
70
|
-
})(["display:flex;flex-direction:column;& > *{margin-top:10px;}& >:first-child{margin-top:0;}"]);
|
|
71
|
-
var ShowButton = exports.ShowButton = _styledComponents.default.div.attrs(function () {
|
|
72
|
-
return {
|
|
73
|
-
role: "button"
|
|
74
|
-
};
|
|
75
|
-
}).withConfig({
|
|
76
|
-
displayName: "Translation__ShowButton",
|
|
77
|
-
componentId: "sc-1w4od1i-2"
|
|
78
|
-
})(["align-self:flex-end;cursor:pointer;"]);
|
|
79
|
-
var ShowButtonChevron = exports.ShowButtonChevron = (0, _styledComponents.default)(_Icon.default).attrs(function (props) {
|
|
80
|
-
return {
|
|
81
|
-
id: (0, _utils.getThemeProp)(["icons", "indicators", "down"], "chevron-down")(props)
|
|
82
|
-
};
|
|
83
|
-
}).withConfig({
|
|
84
|
-
displayName: "Translation__ShowButtonChevron",
|
|
85
|
-
componentId: "sc-1w4od1i-3"
|
|
86
|
-
})(["font-size:10px;margin-right:5px;color:", ";"], (0, _utils.getThemeProp)(["colors", "application", "base"], "#000"));
|
|
87
|
-
var TranslationInput = exports.TranslationInput = function TranslationInput(_ref2) {
|
|
88
|
-
var update = _ref2.update,
|
|
89
|
-
_ref2$value = _ref2.value,
|
|
90
|
-
value = _ref2$value === void 0 ? {} : _ref2$value,
|
|
91
|
-
initShowAll = _ref2.initShowAll,
|
|
92
|
-
required = _ref2.required,
|
|
93
|
-
_ref2$moreLabel = _ref2.moreLabel,
|
|
94
|
-
moreLabel = _ref2$moreLabel === void 0 ? "[more]" : _ref2$moreLabel,
|
|
95
|
-
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
96
|
-
var cultures = (0, _utils.unwrapImmutable)((0, _reactRedux.useSelector)(_locale.orderedCultureList));
|
|
97
|
-
var handlers = (0, _react.useMemo)(function () {
|
|
98
|
-
return cultures.reduce(function (handlers, lang) {
|
|
99
|
-
handlers[lang] = function (event) {
|
|
100
|
-
update(_objectSpread(_objectSpread({}, value), {}, _defineProperty({}, lang, event.target.value)));
|
|
101
|
-
};
|
|
102
|
-
return handlers;
|
|
103
|
-
}, {});
|
|
104
|
-
}, [update, cultures, value]);
|
|
105
|
-
var _useToggle = (0, _useToggle3.default)(initShowAll),
|
|
106
|
-
_useToggle2 = _slicedToArray(_useToggle, 2),
|
|
107
|
-
showAll = _useToggle2[0],
|
|
108
|
-
toggle = _useToggle2[1];
|
|
109
|
-
return /*#__PURE__*/_react.default.createElement(TranslationWrapper, null, cultures.map(function (lang, index) {
|
|
110
|
-
return !index || showAll ? /*#__PURE__*/_react.default.createElement(TranslationField, _extends({
|
|
111
|
-
key: lang,
|
|
112
|
-
lang: lang,
|
|
113
|
-
message: value[lang],
|
|
114
|
-
onChange: handlers[lang],
|
|
115
|
-
required: required
|
|
116
|
-
}, props)) : null;
|
|
117
|
-
}), !showAll && cultures.length > 1 ? /*#__PURE__*/_react.default.createElement(ShowButton, {
|
|
118
|
-
onClick: toggle
|
|
119
|
-
}, /*#__PURE__*/_react.default.createElement(ShowButtonChevron, null), /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
120
|
-
message: moreLabel
|
|
121
|
-
})) : null);
|
|
122
|
-
};
|
|
123
|
-
__signature__(TranslationInput, "useSelector{}\nuseMemo{handlers}\nuseToggle{[showAll, toggle]}", function () {
|
|
124
|
-
return [_reactRedux.useSelector, _useToggle3.default];
|
|
125
|
-
});
|
|
126
|
-
__signature__(TranslationInput, "useSelector{}\nuseMemo{handlers}\nuseToggle{[showAll, toggle]}", function () {
|
|
127
|
-
return [_reactRedux.useSelector, _useToggle3.default];
|
|
128
|
-
});
|
|
129
|
-
var _default = TranslationInput;
|
|
130
|
-
var _default2 = _default;
|
|
131
|
-
var _default3 = exports.default = _default2;
|
|
132
|
-
;
|
|
133
|
-
(function () {
|
|
134
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
135
|
-
if (!reactHotLoader) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
reactHotLoader.register(LanguageLabel, "LanguageLabel", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
139
|
-
reactHotLoader.register(TranslationField, "TranslationField", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
140
|
-
reactHotLoader.register(TranslationWrapper, "TranslationWrapper", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
141
|
-
reactHotLoader.register(ShowButton, "ShowButton", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
142
|
-
reactHotLoader.register(ShowButtonChevron, "ShowButtonChevron", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
143
|
-
reactHotLoader.register(TranslationInput, "TranslationInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
144
|
-
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
145
|
-
})();
|
|
146
|
-
;
|
|
147
|
-
(function () {
|
|
148
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
149
|
-
leaveModule && leaveModule(module);
|
|
150
|
-
})();
|
|
151
|
-
;
|
|
152
|
-
(function () {
|
|
153
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
154
|
-
if (!reactHotLoader) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
reactHotLoader.register(LanguageLabel, "LanguageLabel", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
158
|
-
reactHotLoader.register(TranslationField, "TranslationField", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
159
|
-
reactHotLoader.register(TranslationWrapper, "TranslationWrapper", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
160
|
-
reactHotLoader.register(ShowButton, "ShowButton", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
161
|
-
reactHotLoader.register(ShowButtonChevron, "ShowButtonChevron", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
162
|
-
reactHotLoader.register(TranslationInput, "TranslationInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
163
|
-
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Form/Inputs/Translation.js");
|
|
164
|
-
})();
|
|
165
|
-
;
|
|
166
|
-
(function () {
|
|
167
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
168
|
-
leaveModule && leaveModule(module);
|
|
169
|
-
})();
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import Icon from "../../Icon";
|
|
4
|
-
import { getThemeProp } from "../../../utils";
|
|
5
|
-
|
|
6
|
-
export const MenuIcon = styled(Icon).attrs(props => ({
|
|
7
|
-
id: getThemeProp(["icons", "menu"], "placeholder")(props),
|
|
8
|
-
}))`
|
|
9
|
-
font-size: 24px;
|
|
10
|
-
margin: auto;
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
export const Wrapper = styled.div`
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
width: 50px;
|
|
16
|
-
height: 100%;
|
|
17
|
-
padding: 0 13px;
|
|
18
|
-
display: flex;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
align-items: center;
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
|
|
23
|
-
&:hover {
|
|
24
|
-
background-color: rgba(255, 255, 255, 0.3);
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const Header = ({ toggle, ...props }) => (
|
|
29
|
-
<Wrapper id="applicationSelectorAnchor" onClick={toggle} {...props}>
|
|
30
|
-
<MenuIcon />
|
|
31
|
-
</Wrapper>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export default Header;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Header, { MenuIcon, Wrapper } from "./Header";
|
|
3
|
-
|
|
4
|
-
describe("Header", () => {
|
|
5
|
-
let application, toggle;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
application = {
|
|
8
|
-
label: "Test label",
|
|
9
|
-
src: "/test/url",
|
|
10
|
-
};
|
|
11
|
-
toggle = () => {};
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("renders an icon and label", () =>
|
|
15
|
-
expect(
|
|
16
|
-
<Header open={true} application={application} toggle={toggle} />,
|
|
17
|
-
"when mounted",
|
|
18
|
-
"to satisfy",
|
|
19
|
-
<Wrapper id="applicationSelectorAnchor" onClick={toggle}>
|
|
20
|
-
<MenuIcon />
|
|
21
|
-
</Wrapper>,
|
|
22
|
-
));
|
|
23
|
-
});
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useContext } from "react";
|
|
2
|
-
import styled, { css } from "styled-components";
|
|
3
|
-
import { ifFlag, getThemeProp, memoize } from "../../utils";
|
|
4
|
-
import Button from "../Button";
|
|
5
|
-
import Text from "../Text";
|
|
6
|
-
import { FormContext } from "./Form";
|
|
7
|
-
import FieldElements from "./FieldElements";
|
|
8
|
-
import Field, { FieldBox } from "./Field";
|
|
9
|
-
|
|
10
|
-
export const REMOVE_ROW = "__form_list_remove_row";
|
|
11
|
-
|
|
12
|
-
const generateId = (() => {
|
|
13
|
-
let counter = 0;
|
|
14
|
-
return /* istanbul ignore next */ () => (counter += 1);
|
|
15
|
-
})();
|
|
16
|
-
|
|
17
|
-
const stripLabelFromTree = ({ fields, label, ...remainder }) => {
|
|
18
|
-
const tree = {
|
|
19
|
-
...remainder,
|
|
20
|
-
};
|
|
21
|
-
if (fields && Array.isArray(fields)) {
|
|
22
|
-
tree.fields = fields.map(stripLabelFromTree);
|
|
23
|
-
}
|
|
24
|
-
return tree;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const List = styled.div`
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
${ifFlag(
|
|
31
|
-
"tallRows",
|
|
32
|
-
css`
|
|
33
|
-
& > ${FieldBox} {
|
|
34
|
-
margin: 0;
|
|
35
|
-
padding: 20px 0;
|
|
36
|
-
border-bottom: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
& > ${FieldBox}:first-child {
|
|
40
|
-
margin-top: 15px;
|
|
41
|
-
}
|
|
42
|
-
& > ${FieldBox}:last-child {
|
|
43
|
-
border-bottom: 0 none transparent;
|
|
44
|
-
}
|
|
45
|
-
`,
|
|
46
|
-
css`
|
|
47
|
-
margin-top: 20px;
|
|
48
|
-
|
|
49
|
-
& > ${FieldBox} {
|
|
50
|
-
margin-top: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
& > ${FieldBox} + ${FieldBox} {
|
|
54
|
-
margin-top: 10px;
|
|
55
|
-
}
|
|
56
|
-
`,
|
|
57
|
-
)}
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
export const ListControlButton = styled(Button).attrs(() => ({
|
|
61
|
-
primary: true,
|
|
62
|
-
}))`
|
|
63
|
-
align-self: flex-start;
|
|
64
|
-
min-width: 100px;
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const decorateField = (field, remove = "[remove]") => {
|
|
68
|
-
if (field.type === "Combination") {
|
|
69
|
-
// Add the closer to the tail end of the combo
|
|
70
|
-
/* istanbul ignore next */
|
|
71
|
-
const { fields = [], proportions = [], ...remainder } = field;
|
|
72
|
-
const decoratedProportions = [...proportions];
|
|
73
|
-
decoratedProportions[fields.length] = "30px"; // Set this way to ensure index match
|
|
74
|
-
const decoratedFields = fields.concat([
|
|
75
|
-
{
|
|
76
|
-
type: "SmallButton",
|
|
77
|
-
name: REMOVE_ROW,
|
|
78
|
-
primary: true,
|
|
79
|
-
icon: "cross",
|
|
80
|
-
altText: remove,
|
|
81
|
-
},
|
|
82
|
-
]);
|
|
83
|
-
return {
|
|
84
|
-
...remainder,
|
|
85
|
-
proportions: decoratedProportions,
|
|
86
|
-
fields: decoratedFields,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
// Wrap field in a combo with the closer
|
|
90
|
-
return {
|
|
91
|
-
type: "Combination",
|
|
92
|
-
name: "rowField",
|
|
93
|
-
// Set field base size to fit in field set
|
|
94
|
-
proportions: [100, "30px"],
|
|
95
|
-
fields: [
|
|
96
|
-
field,
|
|
97
|
-
{
|
|
98
|
-
type: "SmallButton",
|
|
99
|
-
name: REMOVE_ROW,
|
|
100
|
-
primary: true,
|
|
101
|
-
icon: "cross",
|
|
102
|
-
altText: remove,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const createRowGetter = (valueList = [], rowCount) => {
|
|
109
|
-
const rows = [];
|
|
110
|
-
if (rowCount === undefined) {
|
|
111
|
-
rows.push(...valueList);
|
|
112
|
-
} else {
|
|
113
|
-
for (let i = 0; i < rowCount; i += 1) {
|
|
114
|
-
const row = { ...valueList[i] };
|
|
115
|
-
if (!row.id) {
|
|
116
|
-
row.id = generateId();
|
|
117
|
-
valueList.forEach(valRow => {
|
|
118
|
-
/* istanbul ignore else */
|
|
119
|
-
if (valRow.id) {
|
|
120
|
-
while (valRow.id >= row.id) {
|
|
121
|
-
row.id = generateId();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
rows.push(row);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return () => rows;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const getListFieldUpdater = (updateAll, getRows) => {
|
|
133
|
-
return memoize(index => {
|
|
134
|
-
if (index < 0) {
|
|
135
|
-
return () => {
|
|
136
|
-
const rows = getRows();
|
|
137
|
-
let id = generateId();
|
|
138
|
-
rows.forEach(row => {
|
|
139
|
-
/* istanbul ignore else */
|
|
140
|
-
if (row.id) {
|
|
141
|
-
while (row.id >= id) {
|
|
142
|
-
id = generateId();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
rows.push({ id });
|
|
147
|
-
updateAll(rows);
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
return memoize(name => {
|
|
151
|
-
if (name === REMOVE_ROW) {
|
|
152
|
-
return () =>
|
|
153
|
-
setTimeout(() => {
|
|
154
|
-
const rows = getRows();
|
|
155
|
-
rows.splice(index, 1);
|
|
156
|
-
updateAll(rows);
|
|
157
|
-
}, 0);
|
|
158
|
-
}
|
|
159
|
-
return value => {
|
|
160
|
-
const rows = getRows();
|
|
161
|
-
rows[index][name] = value;
|
|
162
|
-
updateAll(rows);
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const FieldList = ({ name, staticValues = [], getUpdater, rowField, rowCount, tallRows, ...props }) => {
|
|
169
|
-
const { values, listIndex } = useContext(FormContext);
|
|
170
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
171
|
-
const getRows = useCallback(createRowGetter(values[name], rowCount), [values, name, rowCount]);
|
|
172
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
173
|
-
const listUpdater = useCallback(getListFieldUpdater(getUpdater(name), getRows), [getUpdater, name, getRows]);
|
|
174
|
-
if (listIndex !== undefined) {
|
|
175
|
-
return <>Cannot render list inside list</>;
|
|
176
|
-
}
|
|
177
|
-
const renderField = rowCount === undefined ? decorateField(rowField, props.remove) : rowField;
|
|
178
|
-
return (
|
|
179
|
-
<List {...{ tallRows }}>
|
|
180
|
-
{tallRows ? null : <FieldElements fields={[renderField]} labelOnly />}
|
|
181
|
-
{getRows().map((row, index) => (
|
|
182
|
-
<FormContext.Provider
|
|
183
|
-
key={row.id}
|
|
184
|
-
value={{
|
|
185
|
-
values: {
|
|
186
|
-
...row,
|
|
187
|
-
...staticValues[index],
|
|
188
|
-
},
|
|
189
|
-
listIndex: index,
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
<FieldElements
|
|
193
|
-
fields={[tallRows ? renderField : stripLabelFromTree(renderField)]}
|
|
194
|
-
listIndex={index}
|
|
195
|
-
getUpdater={listUpdater(index)}
|
|
196
|
-
/>
|
|
197
|
-
</FormContext.Provider>
|
|
198
|
-
))}
|
|
199
|
-
{rowCount === undefined ? (
|
|
200
|
-
<Field>
|
|
201
|
-
<ListControlButton onClick={listUpdater(-1)}>
|
|
202
|
-
<Text message={props.add || "[add]"} />
|
|
203
|
-
</ListControlButton>
|
|
204
|
-
</Field>
|
|
205
|
-
) : null}
|
|
206
|
-
</List>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default FieldList;
|