orc-shared 5.9.0-dev.3 → 5.9.0-dev.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.
|
@@ -117,6 +117,14 @@ var SegmentItem = exports.SegmentItem = function SegmentItem(_ref2) {
|
|
|
117
117
|
var asterix = /*#__PURE__*/_react.default.createElement("span", {
|
|
118
118
|
className: classes.asterix
|
|
119
119
|
}, "*");
|
|
120
|
+
if (config.labelValueSelector) {
|
|
121
|
+
var values = config.labelValueSelector(params);
|
|
122
|
+
if (typeof values === "function") {
|
|
123
|
+
config.label.values = values;
|
|
124
|
+
} else if (config.label.values) {
|
|
125
|
+
delete config.label.values;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
120
128
|
var text = /*#__PURE__*/_react.default.createElement(_Text.default, {
|
|
121
129
|
message: config.label
|
|
122
130
|
});
|
package/package.json
CHANGED
|
@@ -98,7 +98,19 @@ export const SegmentItem = ({ isModified, isError, isActive, segpath, config, ba
|
|
|
98
98
|
let hideSelector = state => (typeof config.hide === "function" ? config.hide(params)(state) : config.hide ?? false);
|
|
99
99
|
const isHide = useSelector(hideSelector);
|
|
100
100
|
const asterix = <span className={classes.asterix}>*</span>;
|
|
101
|
+
|
|
102
|
+
if (config.labelValueSelector) {
|
|
103
|
+
const values = config.labelValueSelector(params);
|
|
104
|
+
|
|
105
|
+
if (typeof values === "function") {
|
|
106
|
+
config.label.values = values;
|
|
107
|
+
} else if (config.label.values) {
|
|
108
|
+
delete config.label.values;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
const text = <Text message={config.label} />;
|
|
113
|
+
|
|
102
114
|
const getSectionLabelClassName = (isModified, isError, isDisabled) => {
|
|
103
115
|
let className = classes.label;
|
|
104
116
|
if (isModified) className = `${className} ${classes.modifiedLabel}`;
|
|
@@ -5,8 +5,8 @@ import { createMemoryHistory } from "history";
|
|
|
5
5
|
import SegmentPage, { Wrapper, Item, List } from "./SegmentPage";
|
|
6
6
|
import Grid from "@material-ui/core/Grid";
|
|
7
7
|
import TooltippedTypography from "./../MaterialUI/DataDisplay/TooltippedElements/TooltippedTypography";
|
|
8
|
-
import { TestWrapper, createMuiTheme } from "../../utils/testUtils";
|
|
9
|
-
import
|
|
8
|
+
import { TestWrapper, createMuiTheme, extractMessages } from "../../utils/testUtils";
|
|
9
|
+
import sharedMessages from "../../sharedMessages";
|
|
10
10
|
|
|
11
11
|
const View1 = () => <div id="view1" />;
|
|
12
12
|
const View2 = () => <div id="view2" />;
|
|
@@ -20,12 +20,20 @@ jest.mock("translations/en-US.json", () => ({
|
|
|
20
20
|
|
|
21
21
|
const ComponentLabel = () => <p>Component</p>;
|
|
22
22
|
|
|
23
|
+
const messages = extractMessages(sharedMessages);
|
|
24
|
+
|
|
23
25
|
describe("SegmentPage", () => {
|
|
24
26
|
let state, store, segments;
|
|
25
27
|
|
|
26
28
|
const theme = createMuiTheme();
|
|
27
29
|
|
|
28
|
-
const intlProvider = { messages
|
|
30
|
+
const intlProvider = { messages };
|
|
31
|
+
|
|
32
|
+
const getLabelValueSelector = () => {
|
|
33
|
+
return () => ({
|
|
34
|
+
version: "test version",
|
|
35
|
+
});
|
|
36
|
+
};
|
|
29
37
|
|
|
30
38
|
beforeEach(() => {
|
|
31
39
|
state = Immutable.fromJS({
|
|
@@ -113,6 +121,14 @@ describe("SegmentPage", () => {
|
|
|
113
121
|
label: "HiddenBySelector",
|
|
114
122
|
hide: () => state => true,
|
|
115
123
|
},
|
|
124
|
+
"/eight": {
|
|
125
|
+
label: sharedMessages.orcSharedVersion,
|
|
126
|
+
labelValueSelector: getLabelValueSelector,
|
|
127
|
+
},
|
|
128
|
+
"/nine": {
|
|
129
|
+
label: { ...sharedMessages.copyright, values: {} },
|
|
130
|
+
labelValueSelector: () => "",
|
|
131
|
+
},
|
|
116
132
|
};
|
|
117
133
|
});
|
|
118
134
|
|
|
@@ -171,6 +187,20 @@ describe("SegmentPage", () => {
|
|
|
171
187
|
<Grid item></Grid>
|
|
172
188
|
</Grid>
|
|
173
189
|
</Item>
|
|
190
|
+
<Item to="/foo/meep/entityIdValue/eight">
|
|
191
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
192
|
+
<Grid item>Orc-Shared Framework test version</Grid>
|
|
193
|
+
<Grid item></Grid>
|
|
194
|
+
</Grid>
|
|
195
|
+
</Item>
|
|
196
|
+
<Item to="/foo/meep/entityIdValue/nine">
|
|
197
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
198
|
+
<div>
|
|
199
|
+
<span />
|
|
200
|
+
</div>
|
|
201
|
+
<div />
|
|
202
|
+
</Grid>
|
|
203
|
+
</Item>
|
|
174
204
|
</List>
|
|
175
205
|
<View2 />
|
|
176
206
|
</Wrapper>
|
|
@@ -239,6 +269,20 @@ describe("SegmentPage", () => {
|
|
|
239
269
|
<Grid item></Grid>
|
|
240
270
|
</Grid>
|
|
241
271
|
</Item>
|
|
272
|
+
<Item to="/foo/meep/entityIdValue/eight">
|
|
273
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
274
|
+
<Grid item>Orc-Shared Framework test version</Grid>
|
|
275
|
+
<Grid item></Grid>
|
|
276
|
+
</Grid>
|
|
277
|
+
</Item>
|
|
278
|
+
<Item to="/foo/meep/entityIdValue/nine">
|
|
279
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
280
|
+
<div>
|
|
281
|
+
<span />
|
|
282
|
+
</div>
|
|
283
|
+
<div />
|
|
284
|
+
</Grid>
|
|
285
|
+
</Item>
|
|
242
286
|
</List>
|
|
243
287
|
<View2 />
|
|
244
288
|
</Wrapper>
|
|
@@ -353,6 +397,20 @@ describe("SegmentPage", () => {
|
|
|
353
397
|
<Grid item></Grid>
|
|
354
398
|
</Grid>
|
|
355
399
|
</Item>
|
|
400
|
+
<Item to="/foo/meep/entityIdValue/eight">
|
|
401
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
402
|
+
<Grid item>Orc-Shared Framework test version</Grid>
|
|
403
|
+
<Grid item></Grid>
|
|
404
|
+
</Grid>
|
|
405
|
+
</Item>
|
|
406
|
+
<Item to="/foo/meep/entityIdValue/nine">
|
|
407
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
408
|
+
<div>
|
|
409
|
+
<span />
|
|
410
|
+
</div>
|
|
411
|
+
<div />
|
|
412
|
+
</Grid>
|
|
413
|
+
</Item>
|
|
356
414
|
</List>
|
|
357
415
|
</MemoryRouter>
|
|
358
416
|
<View1 />
|
|
@@ -421,6 +479,20 @@ describe("SegmentPage", () => {
|
|
|
421
479
|
<Grid item></Grid>
|
|
422
480
|
</Grid>
|
|
423
481
|
</Item>
|
|
482
|
+
<Item to="/foo/meep/entityIdValue/eight">
|
|
483
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
484
|
+
<Grid item>Orc-Shared Framework test version</Grid>
|
|
485
|
+
<Grid item></Grid>
|
|
486
|
+
</Grid>
|
|
487
|
+
</Item>
|
|
488
|
+
<Item to="/foo/meep/entityIdValue/nine">
|
|
489
|
+
<Grid container alignItems="center" wrap="nowrap">
|
|
490
|
+
<div>
|
|
491
|
+
<span />
|
|
492
|
+
</div>
|
|
493
|
+
<div />
|
|
494
|
+
</Grid>
|
|
495
|
+
</Item>
|
|
424
496
|
</List>
|
|
425
497
|
</MemoryRouter>
|
|
426
498
|
<View1 />
|