grep-components 1.26.2-GREPF-2195.1 → 1.26.2-GREPF-2186.1
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.js +1597 -1308
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,19 +47,26 @@ import Link$1 from '@mui/material/Link';
|
|
|
47
47
|
dayjs.extend(isBetweenPlugin);
|
|
48
48
|
dayjs.extend(LocalizedFormatPlugin);
|
|
49
49
|
dayjs.locale('nb');
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
var DateRangeValue = /** @class */ (function () {
|
|
51
|
+
function DateRangeValue(from, to) {
|
|
52
52
|
this.from = from;
|
|
53
53
|
this.to = to;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
Object.defineProperty(DateRangeValue.prototype, "valid", {
|
|
56
|
+
get: function () {
|
|
57
|
+
return this.isValid();
|
|
58
|
+
},
|
|
59
|
+
enumerable: false,
|
|
60
|
+
configurable: true
|
|
61
|
+
});
|
|
62
|
+
DateRangeValue.prototype.isValid = function (allowNull, allowSame, unit) {
|
|
63
|
+
if (allowNull === void 0) { allowNull = true; }
|
|
64
|
+
if (allowSame === void 0) { allowSame = true; }
|
|
65
|
+
if (unit === void 0) { unit = 'day'; }
|
|
59
66
|
if (!this.from && !this.to)
|
|
60
67
|
return allowNull;
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
var dateFrom = dayjs(this.from || undefined);
|
|
69
|
+
var dateTo = dayjs(this.to || undefined);
|
|
63
70
|
if (!this.from)
|
|
64
71
|
return allowNull && dateTo.isValid();
|
|
65
72
|
if (!this.to)
|
|
@@ -70,13 +77,17 @@ class DateRangeValue {
|
|
|
70
77
|
: dateTo.isAfter(dateFrom, unit);
|
|
71
78
|
}
|
|
72
79
|
return false;
|
|
73
|
-
}
|
|
74
|
-
compare
|
|
80
|
+
};
|
|
81
|
+
DateRangeValue.prototype.compare = function (_a, unit) {
|
|
82
|
+
var from = _a.from, to = _a.to;
|
|
83
|
+
if (unit === void 0) { unit = 'day'; }
|
|
75
84
|
return (dayjs(this.from || '').isSame(dayjs(from || ''), unit) &&
|
|
76
85
|
dayjs(this.to || '').isSame(dayjs(to || ''), unit));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
};
|
|
87
|
+
return DateRangeValue;
|
|
88
|
+
}());
|
|
89
|
+
var parseDate = function (datetime, _a) {
|
|
90
|
+
var _b = _a === void 0 ? { utc: true } : _a, format = _b.format, utc = _b.utc;
|
|
80
91
|
datetime =
|
|
81
92
|
typeof datetime === 'string'
|
|
82
93
|
? datetime
|
|
@@ -85,28 +96,34 @@ const parseDate = (datetime, { format, utc } = { utc: true }) => {
|
|
|
85
96
|
.replace(/(^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3})(\d*)$/, '$1')
|
|
86
97
|
: datetime;
|
|
87
98
|
// dirty hack to not provide utc flag
|
|
88
|
-
|
|
99
|
+
var parsed = dayjs(datetime, { utc: utc, format: format });
|
|
89
100
|
return parsed.isValid() ? dayjs(parsed.toISOString()) : parsed;
|
|
90
101
|
};
|
|
91
|
-
|
|
102
|
+
var hasDateChanged = function (a, b) {
|
|
92
103
|
if (a === null || b === null) {
|
|
93
104
|
return a !== b;
|
|
94
105
|
}
|
|
95
106
|
return dayjs(a).format('L') !== dayjs(b).format('L');
|
|
96
107
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
var isDateValid = function (date, allowNull) {
|
|
109
|
+
return !date ? !!allowNull : dayjs(date).isValid();
|
|
110
|
+
};
|
|
111
|
+
var isSameOrBefore = function (point, match, unit) {
|
|
112
|
+
if (unit === void 0) { unit = 'day'; }
|
|
113
|
+
var date = dayjs(point);
|
|
100
114
|
return ((date.isValid() && date.isSame(match, unit)) || date.isBefore(match, unit));
|
|
101
115
|
};
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
var isSameOrAfter = function (point, match, unit) {
|
|
117
|
+
if (unit === void 0) { unit = 'day'; }
|
|
118
|
+
var date = dayjs(point);
|
|
104
119
|
return ((date.isValid() && date.isSame(match, unit)) || date.isAfter(match, unit));
|
|
105
120
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
121
|
+
var getShortDate = function (datetime, options) { return parseDate(datetime, options).format('L'); };
|
|
122
|
+
var getTime = function (datetime, options) {
|
|
123
|
+
return parseDate(datetime, options).format('[kl.] LT');
|
|
124
|
+
};
|
|
125
|
+
var getFullDate = function (datetime, options) { return parseDate(datetime, options).format('LLL'); };
|
|
126
|
+
var getExcelDateTime = function (datetime, options) { return parseDate(datetime, options).format('L HH:mm'); };
|
|
110
127
|
|
|
111
128
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
112
129
|
|
|
@@ -232,16 +249,16 @@ var Key_enum = {};
|
|
|
232
249
|
})(exports.Key || (exports.Key = {}));
|
|
233
250
|
} (Key_enum));
|
|
234
251
|
|
|
235
|
-
|
|
252
|
+
var onActivation = function (cb) { return function (ev) {
|
|
236
253
|
switch (ev.which) {
|
|
237
254
|
case Key_enum.Key.Space:
|
|
238
255
|
case Key_enum.Key.Enter:
|
|
239
256
|
cb(ev);
|
|
240
257
|
break;
|
|
241
258
|
}
|
|
242
|
-
};
|
|
259
|
+
}; };
|
|
243
260
|
var keyboard = {
|
|
244
|
-
onActivation,
|
|
261
|
+
onActivation: onActivation,
|
|
245
262
|
};
|
|
246
263
|
|
|
247
264
|
var index = /*#__PURE__*/Object.freeze({
|
|
@@ -260,7 +277,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
260
277
|
DateTime: dayjs
|
|
261
278
|
});
|
|
262
279
|
|
|
263
|
-
|
|
280
|
+
var Colors = {
|
|
264
281
|
red: red[500],
|
|
265
282
|
pink: pink[500],
|
|
266
283
|
purple: purple[500],
|
|
@@ -287,30 +304,111 @@ const Colors = {
|
|
|
287
304
|
white: '#fff',
|
|
288
305
|
};
|
|
289
306
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
/******************************************************************************
|
|
308
|
+
Copyright (c) Microsoft Corporation.
|
|
309
|
+
|
|
310
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
311
|
+
purpose with or without fee is hereby granted.
|
|
312
|
+
|
|
313
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
314
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
315
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
316
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
317
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
318
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
319
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
320
|
+
***************************************************************************** */
|
|
321
|
+
/* global Reflect, Promise */
|
|
322
|
+
|
|
323
|
+
var extendStatics = function(d, b) {
|
|
324
|
+
extendStatics = Object.setPrototypeOf ||
|
|
325
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
326
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
327
|
+
return extendStatics(d, b);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
function __extends(d, b) {
|
|
331
|
+
if (typeof b !== "function" && b !== null)
|
|
332
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
333
|
+
extendStatics(d, b);
|
|
334
|
+
function __() { this.constructor = d; }
|
|
335
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var __assign = function() {
|
|
339
|
+
__assign = Object.assign || function __assign(t) {
|
|
340
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
341
|
+
s = arguments[i];
|
|
342
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
343
|
+
}
|
|
344
|
+
return t;
|
|
345
|
+
};
|
|
346
|
+
return __assign.apply(this, arguments);
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
function __rest$1(s, e) {
|
|
350
|
+
var t = {};
|
|
351
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
352
|
+
t[p] = s[p];
|
|
353
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
354
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
355
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
356
|
+
t[p[i]] = s[p[i]];
|
|
357
|
+
}
|
|
358
|
+
return t;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function __read(o, n) {
|
|
362
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
363
|
+
if (!m) return o;
|
|
364
|
+
var i = m.call(o), r, ar = [], e;
|
|
365
|
+
try {
|
|
366
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
367
|
+
}
|
|
368
|
+
catch (error) { e = { error: error }; }
|
|
369
|
+
finally {
|
|
370
|
+
try {
|
|
371
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
372
|
+
}
|
|
373
|
+
finally { if (e) throw e.error; }
|
|
374
|
+
}
|
|
375
|
+
return ar;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function __spreadArray(to, from, pack) {
|
|
379
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
380
|
+
if (ar || !(i in from)) {
|
|
381
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
382
|
+
ar[i] = from[i];
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
var hexPattern = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;
|
|
389
|
+
var hexPatternShorthand = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
390
|
+
var convertHex2rgb = function (hex) {
|
|
391
|
+
var match = hex
|
|
392
|
+
.replace(hexPatternShorthand, function (_m, r, g, b) { return r + r + g + g + b + b; })
|
|
295
393
|
.match(hexPattern);
|
|
296
394
|
match && match.shift();
|
|
297
|
-
return match ? match.map((i)
|
|
395
|
+
return match ? match.map(function (i) { return parseInt(i, 16); }) : [];
|
|
298
396
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return rgb &&
|
|
397
|
+
var hex2rgb = function (hex) {
|
|
398
|
+
var rgb = convertHex2rgb(hex);
|
|
399
|
+
return rgb && "rgb(".concat(rgb.join(','), ")");
|
|
302
400
|
};
|
|
303
|
-
|
|
304
|
-
|
|
401
|
+
var hex2rgba = function (hex, alpha) {
|
|
402
|
+
var rgb = convertHex2rgb(hex);
|
|
305
403
|
rgb && rgb.push(alpha);
|
|
306
|
-
return rgb &&
|
|
404
|
+
return rgb && "rgba(".concat(rgb.join(','), ")");
|
|
307
405
|
};
|
|
308
|
-
|
|
406
|
+
var convertToRgba = function (color, alpha) {
|
|
309
407
|
if (color.match(/^#/)) {
|
|
310
408
|
return hex2rgba(color, alpha);
|
|
311
409
|
}
|
|
312
|
-
|
|
313
|
-
return value ?
|
|
410
|
+
var _a = __read(color.match(/[(](.*)[)]/) || [], 2), value = _a[1];
|
|
411
|
+
return value ? "rgba(".concat(value, ", ").concat(alpha, ")") : color;
|
|
314
412
|
};
|
|
315
413
|
|
|
316
414
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -2861,29 +2959,33 @@ function createMakeAndWithStyles(params) {
|
|
|
2861
2959
|
return Object.assign(Object.assign({}, createMakeStyles(params)), createWithStyles(params));
|
|
2862
2960
|
}
|
|
2863
2961
|
|
|
2864
|
-
|
|
2865
|
-
|
|
2962
|
+
var _a;
|
|
2963
|
+
var makeStyles = (_a = createMakeAndWithStyles({
|
|
2964
|
+
useTheme: useTheme,
|
|
2866
2965
|
/*
|
|
2867
2966
|
OR, if you have extended the default mui theme adding your own custom properties:
|
|
2868
2967
|
Let's assume the myTheme object that you provide to the <ThemeProvider /> is of
|
|
2869
2968
|
type MyTheme then you'll write:
|
|
2870
2969
|
*/
|
|
2871
2970
|
//"useTheme": useTheme as (()=> MyTheme)
|
|
2971
|
+
}), _a.makeStyles), withStyles = _a.withStyles;
|
|
2972
|
+
|
|
2973
|
+
var useStyles$i = makeStyles()(function (_a) {
|
|
2974
|
+
var palette = _a.palette;
|
|
2975
|
+
return ({
|
|
2976
|
+
user: {
|
|
2977
|
+
color: palette.text.primary,
|
|
2978
|
+
margin: '0 10px',
|
|
2979
|
+
marginLeft: 20,
|
|
2980
|
+
height: 'fit-content',
|
|
2981
|
+
textAlign: 'left',
|
|
2982
|
+
textTransform: 'none',
|
|
2983
|
+
},
|
|
2984
|
+
});
|
|
2872
2985
|
});
|
|
2873
2986
|
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
color: palette.text.primary,
|
|
2877
|
-
margin: '0 10px',
|
|
2878
|
-
marginLeft: 20,
|
|
2879
|
-
height: 'fit-content',
|
|
2880
|
-
textAlign: 'left',
|
|
2881
|
-
textTransform: 'none',
|
|
2882
|
-
},
|
|
2883
|
-
}));
|
|
2884
|
-
|
|
2885
|
-
const AppBarProfile = (props) => {
|
|
2886
|
-
const { classes } = useStyles$i();
|
|
2987
|
+
var AppBarProfile = function (props) {
|
|
2988
|
+
var classes = useStyles$i().classes;
|
|
2887
2989
|
return (React.createElement(Button, { variant: "text", onClick: props.onButtonClick },
|
|
2888
2990
|
React.createElement(AccountCircle, { color: "primary", fontSize: "large" }),
|
|
2889
2991
|
React.createElement(Box, { className: classes.user },
|
|
@@ -2892,76 +2994,87 @@ const AppBarProfile = (props) => {
|
|
|
2892
2994
|
React.createElement(ArrowDropdown, { color: "primary" })));
|
|
2893
2995
|
};
|
|
2894
2996
|
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
maxWidth: 40,
|
|
2937
|
-
width: '100%',
|
|
2938
|
-
backgroundColor: theme.palette.secondary.main,
|
|
2939
|
-
},
|
|
2940
|
-
},
|
|
2941
|
-
}));
|
|
2942
|
-
const useMobileStyles = makeStyles()(({ palette, breakpoints }) => ({
|
|
2943
|
-
mobileNavList: {
|
|
2944
|
-
backgroundColor: `transparent`,
|
|
2945
|
-
color: palette.primary.main,
|
|
2946
|
-
fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
|
|
2947
|
-
[breakpoints.down('lg')]: {
|
|
2997
|
+
var useStyles$h = makeStyles()(function (theme) {
|
|
2998
|
+
var _a, _b;
|
|
2999
|
+
return ({
|
|
3000
|
+
tabs: (_a = {
|
|
3001
|
+
margin: 'auto 0'
|
|
3002
|
+
},
|
|
3003
|
+
_a[theme.breakpoints.down('xl')] = {
|
|
3004
|
+
display: 'none',
|
|
3005
|
+
},
|
|
3006
|
+
_a[theme.breakpoints.up('lg')] = {
|
|
3007
|
+
display: 'grid',
|
|
3008
|
+
},
|
|
3009
|
+
_a),
|
|
3010
|
+
tab: (_b = {
|
|
3011
|
+
textTransform: 'uppercase',
|
|
3012
|
+
color: theme.palette.primary.main,
|
|
3013
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
3014
|
+
fontSize: theme.typography.subtitle1.fontSize,
|
|
3015
|
+
marginRight: theme.spacing(1),
|
|
3016
|
+
'&:focus': {
|
|
3017
|
+
opacity: 1,
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
3020
|
+
_b[theme.breakpoints.down('lg')] = {
|
|
3021
|
+
minWidth: 120,
|
|
3022
|
+
marginRight: 0,
|
|
3023
|
+
},
|
|
3024
|
+
_b[theme.breakpoints.up('lg')] = {
|
|
3025
|
+
minWidth: 160,
|
|
3026
|
+
padding: '12px',
|
|
3027
|
+
},
|
|
3028
|
+
_b[theme.breakpoints.up('lg')] = {
|
|
3029
|
+
minWidth: 160,
|
|
3030
|
+
padding: '12px',
|
|
3031
|
+
},
|
|
3032
|
+
_b[theme.breakpoints.up('lg')] = {
|
|
3033
|
+
minWidth: 160,
|
|
3034
|
+
padding: '12px',
|
|
3035
|
+
},
|
|
3036
|
+
_b),
|
|
3037
|
+
indicator: {
|
|
2948
3038
|
display: 'flex',
|
|
3039
|
+
justifyContent: 'center',
|
|
3040
|
+
backgroundColor: 'transparent',
|
|
3041
|
+
'& > div': {
|
|
3042
|
+
maxWidth: 40,
|
|
3043
|
+
width: '100%',
|
|
3044
|
+
backgroundColor: theme.palette.secondary.main,
|
|
3045
|
+
},
|
|
2949
3046
|
},
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3047
|
+
});
|
|
3048
|
+
});
|
|
3049
|
+
var useMobileStyles = makeStyles()(function (_a) {
|
|
3050
|
+
var _b;
|
|
3051
|
+
var palette = _a.palette, breakpoints = _a.breakpoints;
|
|
3052
|
+
return ({
|
|
3053
|
+
mobileNavList: (_b = {
|
|
3054
|
+
backgroundColor: "transparent",
|
|
3055
|
+
color: palette.primary.main,
|
|
3056
|
+
fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif'
|
|
3057
|
+
},
|
|
3058
|
+
_b[breakpoints.down('lg')] = {
|
|
3059
|
+
display: 'flex',
|
|
3060
|
+
},
|
|
3061
|
+
_b[breakpoints.up('lg')] = {
|
|
3062
|
+
display: 'none',
|
|
3063
|
+
},
|
|
3064
|
+
_b),
|
|
3065
|
+
});
|
|
3066
|
+
});
|
|
3067
|
+
|
|
3068
|
+
var MobileAppBarNavList = function (_a) {
|
|
3069
|
+
var pages = _a.pages;
|
|
3070
|
+
var classes = useMobileStyles().classes;
|
|
3071
|
+
var history = useHistory();
|
|
3072
|
+
var _b = __read(React.useState(null), 2), anchorElNav = _b[0], setAnchorElNav = _b[1];
|
|
3073
|
+
var openNav = Boolean(anchorElNav);
|
|
3074
|
+
var handleClickNav = function (event) {
|
|
2962
3075
|
setAnchorElNav(event.currentTarget);
|
|
2963
3076
|
};
|
|
2964
|
-
|
|
3077
|
+
var handleCloseNav = function () {
|
|
2965
3078
|
setAnchorElNav(null);
|
|
2966
3079
|
};
|
|
2967
3080
|
return (React.createElement(Box, { style: { flexGrow: 1 }, className: classes.mobileNavList },
|
|
@@ -2969,30 +3082,34 @@ const MobileAppBarNavList = ({ pages, }) => {
|
|
|
2969
3082
|
React.createElement(MenuIcon, { fontSize: "large" })),
|
|
2970
3083
|
React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElNav, open: openNav, onClose: handleCloseNav, MenuListProps: {
|
|
2971
3084
|
'aria-labelledby': 'basic-button',
|
|
2972
|
-
} }, pages.map((page)
|
|
3085
|
+
} }, pages.map(function (page) { return (React.createElement(MenuItem, { key: page.id, onClick: function () {
|
|
2973
3086
|
handleCloseNav();
|
|
2974
|
-
history.push(page
|
|
2975
|
-
}, onKeyDown: keyboard.onActivation(
|
|
3087
|
+
history.push((page === null || page === void 0 ? void 0 : page.toUrl) || '');
|
|
3088
|
+
}, onKeyDown: keyboard.onActivation(function () {
|
|
3089
|
+
return history.push((page === null || page === void 0 ? void 0 : page.toUrl) || '');
|
|
3090
|
+
}) }, page.label)); }))));
|
|
2976
3091
|
};
|
|
2977
3092
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3093
|
+
var AppBarNavList = function (_a) {
|
|
3094
|
+
var selectedPage = _a.selectedPage, pages = _a.pages, onChange = _a.onChange;
|
|
3095
|
+
var _b = __read(React.useState(selectedPage), 2), value = _b[0], setValue = _b[1];
|
|
3096
|
+
var classes = useStyles$h().classes;
|
|
3097
|
+
var handleChange = function (_event, newValue) {
|
|
2982
3098
|
setValue(newValue);
|
|
2983
3099
|
onChange(newValue);
|
|
2984
3100
|
};
|
|
2985
3101
|
return (React.createElement(React.Fragment, null,
|
|
2986
|
-
React.createElement(Tabs, { classes: { root: classes.tabs, indicator: classes.indicator }, value: value, onChange: handleChange, TabIndicatorProps: { children: React.createElement("div", null) } }, pages.map((page)
|
|
3102
|
+
React.createElement(Tabs, { classes: { root: classes.tabs, indicator: classes.indicator }, value: value, onChange: handleChange, TabIndicatorProps: { children: React.createElement("div", null) } }, pages.map(function (page) { return (React.createElement(Tab, { disableTouchRipple: true, className: classes.tab, key: page.id, label: page.label })); })),
|
|
2987
3103
|
React.createElement(MobileAppBarNavList, { pages: pages })));
|
|
2988
3104
|
};
|
|
2989
3105
|
|
|
2990
|
-
|
|
3106
|
+
var BodyLayout = function (props) { return (React.createElement(Box, { width: "100%", paddingTop: "20px", display: "flex", flexDirection: "row", marginBottom: "20px", justifyContent: "space-between" }, props.children)); };
|
|
2991
3107
|
|
|
2992
|
-
|
|
3108
|
+
var MainLayout = function (props) { return (React.createElement(Box, { display: "flex", flex: "1", flexDirection: "column" }, props.children)); };
|
|
2993
3109
|
|
|
2994
|
-
|
|
2995
|
-
|
|
3110
|
+
var CollapsableMenu = function (_a) {
|
|
3111
|
+
var children = _a.children, onMenuClose = _a.onMenuClose, collapseProps = __rest$1(_a, ["children", "onMenuClose"]);
|
|
3112
|
+
var onKeyDown = function (e) {
|
|
2996
3113
|
switch (e.keyCode) {
|
|
2997
3114
|
case Key_enum.Key.Escape:
|
|
2998
3115
|
onMenuClose && onMenuClose();
|
|
@@ -3002,33 +3119,37 @@ const CollapsableMenu = ({ children, onMenuClose, ...collapseProps }) => {
|
|
|
3002
3119
|
}
|
|
3003
3120
|
e.stopPropagation();
|
|
3004
3121
|
};
|
|
3005
|
-
return (React__default.createElement(Collapse, { timeout: "auto", unmountOnExit: true, mountOnEnter: true,
|
|
3122
|
+
return (React__default.createElement(Collapse, __assign({ timeout: "auto", unmountOnExit: true, mountOnEnter: true }, collapseProps),
|
|
3006
3123
|
React__default.createElement(MenuList, { disablePadding: true, autoFocusItem: true, onKeyDown: onKeyDown }, children)));
|
|
3007
3124
|
};
|
|
3008
3125
|
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3126
|
+
var useStyles$g = makeStyles()(function (_a, _b) {
|
|
3127
|
+
var palette = _a.palette, transitions = _a.transitions;
|
|
3128
|
+
var open = _b.open;
|
|
3129
|
+
return ({
|
|
3130
|
+
root: {
|
|
3131
|
+
padding: '0 1rem',
|
|
3132
|
+
transition: transitions.create(['background-color'], {
|
|
3133
|
+
duration: transitions.duration.short,
|
|
3134
|
+
easing: transitions.easing.easeIn,
|
|
3135
|
+
}),
|
|
3136
|
+
'&.Mui-focusVisible': {
|
|
3137
|
+
backgroundColor: convertToRgba(palette.primary.light, 0.15),
|
|
3138
|
+
},
|
|
3018
3139
|
},
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
})
|
|
3140
|
+
subMenu: {
|
|
3141
|
+
margin: '0 -1rem',
|
|
3142
|
+
},
|
|
3143
|
+
expander: {
|
|
3144
|
+
marginLeft: '2rem',
|
|
3145
|
+
transform: "rotate(".concat(open ? 180 : 0, "deg)"),
|
|
3146
|
+
transition: transitions.create(['transform, color, background-color'], {
|
|
3147
|
+
duration: transitions.duration.short,
|
|
3148
|
+
easing: transitions.easing.easeOut,
|
|
3149
|
+
}),
|
|
3150
|
+
},
|
|
3151
|
+
});
|
|
3152
|
+
});
|
|
3032
3153
|
|
|
3033
3154
|
/**
|
|
3034
3155
|
* TypeError: Failed to construct 'CustomEvent': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
|
|
@@ -3036,36 +3157,42 @@ const useStyles$g = makeStyles()(({ palette, transitions }, { open }) => ({
|
|
|
3036
3157
|
*
|
|
3037
3158
|
* export class CollapsableMenuStatusEvent extends CustomEvent<React.Ref<any>> {}
|
|
3038
3159
|
*/
|
|
3039
|
-
|
|
3040
|
-
|
|
3160
|
+
var CollapsableMenuStatusEvent = /** @class */ (function () {
|
|
3161
|
+
function CollapsableMenuStatusEvent(type, currentTarget) {
|
|
3041
3162
|
this.type = type;
|
|
3042
3163
|
this.currentTarget = currentTarget;
|
|
3043
3164
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3165
|
+
Object.defineProperty(CollapsableMenuStatusEvent.prototype, "defaultPrevented", {
|
|
3166
|
+
get: function () {
|
|
3167
|
+
return !!this._defaultPrevented;
|
|
3168
|
+
},
|
|
3169
|
+
enumerable: false,
|
|
3170
|
+
configurable: true
|
|
3171
|
+
});
|
|
3172
|
+
CollapsableMenuStatusEvent.prototype.preventDefault = function () {
|
|
3048
3173
|
this._defaultPrevented = true;
|
|
3049
|
-
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3174
|
+
};
|
|
3175
|
+
return CollapsableMenuStatusEvent;
|
|
3176
|
+
}());
|
|
3177
|
+
var CollapsableMenuItem = function (_a) {
|
|
3178
|
+
var items = _a.items, onClick = _a.onClick, children = _a.children; _a.onClose; var tooltipText = _a.tooltipText, disabled = _a.disabled, props = __rest$1(_a, ["items", "onClick", "children", "onClose", "tooltipText", "disabled"]);
|
|
3179
|
+
var listItemRef = useRef(null);
|
|
3180
|
+
var _b = __read(useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
3181
|
+
var onStatusChange = useCallback$1(function (type) { return new CollapsableMenuStatusEvent(type, listItemRef); }, [listItemRef]);
|
|
3182
|
+
var expand = useCallback$1(function () {
|
|
3183
|
+
var event = onStatusChange('expand');
|
|
3057
3184
|
!event.defaultPrevented && setOpen(true);
|
|
3058
3185
|
return !event.defaultPrevented;
|
|
3059
3186
|
}, [onStatusChange, setOpen]);
|
|
3060
|
-
|
|
3061
|
-
|
|
3187
|
+
var collapse = useCallback$1(function () {
|
|
3188
|
+
var event = onStatusChange('collapse');
|
|
3062
3189
|
if (!event.defaultPrevented) {
|
|
3063
3190
|
setOpen(false);
|
|
3064
|
-
requestAnimationFrame(()
|
|
3191
|
+
requestAnimationFrame(function () { var _a; return (_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
3065
3192
|
}
|
|
3066
3193
|
return !event.defaultPrevented;
|
|
3067
3194
|
}, [onStatusChange, setOpen, listItemRef]);
|
|
3068
|
-
|
|
3195
|
+
var handleKey = function (e) {
|
|
3069
3196
|
if (items) {
|
|
3070
3197
|
switch (e.keyCode) {
|
|
3071
3198
|
case Key_enum.Key.RightArrow:
|
|
@@ -3077,181 +3204,204 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
|
|
|
3077
3204
|
}
|
|
3078
3205
|
}
|
|
3079
3206
|
};
|
|
3080
|
-
|
|
3207
|
+
var onToggleClick = useCallback$1(function (e) {
|
|
3081
3208
|
e.preventDefault();
|
|
3082
3209
|
e.stopPropagation();
|
|
3083
3210
|
open ? collapse() : expand();
|
|
3084
3211
|
}, [open, collapse, expand]);
|
|
3085
|
-
|
|
3086
|
-
|
|
3212
|
+
var onScrimClick = useCallback$1(function (e) {
|
|
3213
|
+
var _a;
|
|
3214
|
+
var scrimClick = !((_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target));
|
|
3087
3215
|
scrimClick && collapse();
|
|
3088
3216
|
}, [listItemRef, collapse]);
|
|
3089
|
-
|
|
3090
|
-
useEffect(()
|
|
3217
|
+
var handleClick = items ? onToggleClick : onClick;
|
|
3218
|
+
useEffect(function () {
|
|
3091
3219
|
document.addEventListener('click', onScrimClick, { capture: true });
|
|
3092
|
-
return ()
|
|
3220
|
+
return function () { return document.removeEventListener('click', onScrimClick); };
|
|
3093
3221
|
}, [listItemRef, onScrimClick]);
|
|
3094
|
-
|
|
3095
|
-
|
|
3222
|
+
var classes = useStyles$g({ open: open }).classes;
|
|
3223
|
+
var renderInner = function () { return (React__default.createElement(Box, { display: "flex", flexDirection: "column", width: "100%" },
|
|
3096
3224
|
React__default.createElement(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", minHeight: 48 },
|
|
3097
3225
|
children,
|
|
3098
3226
|
items && React__default.createElement(IconExpand, { className: classes.expander })),
|
|
3099
|
-
items && (React__default.createElement(CollapsableMenu, { className: classes.subMenu, in: open, onMenuClose: collapse, onEntered:
|
|
3227
|
+
items && (React__default.createElement(CollapsableMenu, { className: classes.subMenu, in: open, onMenuClose: collapse, onEntered: function () {
|
|
3228
|
+
return requestAnimationFrame(function () {
|
|
3229
|
+
return window.dispatchEvent(new Event('resize'));
|
|
3230
|
+
});
|
|
3231
|
+
} }, items)))); };
|
|
3100
3232
|
return tooltipText ? (React__default.createElement(Tooltip, { title: tooltipText },
|
|
3101
3233
|
React__default.createElement(MenuItem, { role: "menuitem", sx: disabled && !items
|
|
3102
3234
|
? { cursor: 'not-allowed', pointerEvents: 'inherit !important' }
|
|
3103
|
-
: { pointerEvents: 'inherit !important' }, className: classes.root, onMouseOver: (e)
|
|
3235
|
+
: { pointerEvents: 'inherit !important' }, className: classes.root, onMouseOver: function (e) { return e.currentTarget.focus(); }, selected: open, ref: listItemRef, onClick: handleClick, onKeyDown: handleKey }, renderInner()))) : (React__default.createElement(MenuItem, __assign({ sx: disabled && !items ? { cursor: 'not-allowed' } : {}, className: classes.root, onMouseOver: function (e) { return e.currentTarget.focus(); }, ref: listItemRef, selected: open, onClick: handleClick, onKeyDown: handleKey }, props), renderInner()));
|
|
3104
3236
|
};
|
|
3105
3237
|
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
(
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
:
|
|
3126
|
-
|
|
3238
|
+
var useStyles$f = makeStyles()(function (_a) {
|
|
3239
|
+
var palette = _a.palette;
|
|
3240
|
+
return ({
|
|
3241
|
+
selected: {
|
|
3242
|
+
color: "".concat(palette.common.black, " !important"),
|
|
3243
|
+
backgroundColor: 'rgba(0,0,0,.05) !important',
|
|
3244
|
+
},
|
|
3245
|
+
});
|
|
3246
|
+
});
|
|
3247
|
+
|
|
3248
|
+
var DropdownMenu = function (_a) {
|
|
3249
|
+
var context = _a.context, menuItems = _a.menuItems, menuProps = __rest$1(_a, ["context", "menuItems"]);
|
|
3250
|
+
var classes = useStyles$f().classes;
|
|
3251
|
+
var renderChild = function (level, parentDisabled) {
|
|
3252
|
+
if (level === void 0) { level = 0; }
|
|
3253
|
+
// eslint-disable-next-line react/display-name
|
|
3254
|
+
return function (item, index) {
|
|
3255
|
+
var _a;
|
|
3256
|
+
var label = item.label, children = item.children, handleClick = item.handleClick, disabled = item.disabled, props = __rest$1(item, ["label", "children", "handleClick", "disabled"]);
|
|
3257
|
+
var itemOrParentDisabled = (_a = (parentDisabled || disabled)) !== null && _a !== void 0 ? _a : false;
|
|
3258
|
+
var isDisabled = typeof itemOrParentDisabled === 'function'
|
|
3259
|
+
? itemOrParentDisabled(context)
|
|
3260
|
+
: itemOrParentDisabled;
|
|
3261
|
+
var style = isDisabled
|
|
3262
|
+
? { paddingLeft: "".concat(level * 0.5, "rem"), opacity: 0.4 }
|
|
3263
|
+
: {
|
|
3264
|
+
paddingLeft: "".concat(level * 0.5, "rem"),
|
|
3265
|
+
};
|
|
3266
|
+
props.key = "child-item-".concat(index);
|
|
3267
|
+
props.classes = { selected: classes.selected };
|
|
3268
|
+
// ninja way, since rewriting existing code on lpu and admin is daunting
|
|
3269
|
+
props.onClick = function (e) {
|
|
3270
|
+
if (isDisabled) {
|
|
3271
|
+
e.preventDefault();
|
|
3272
|
+
e.stopPropagation();
|
|
3273
|
+
return;
|
|
3274
|
+
}
|
|
3275
|
+
menuProps.onClose && menuProps.onClose(e, 'backdropClick');
|
|
3276
|
+
!isDisabled && handleClick && handleClick(context);
|
|
3127
3277
|
};
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
// ninja way, since rewriting existing code on lpu and admin is daunting
|
|
3131
|
-
props.onClick = (e) => {
|
|
3132
|
-
if (isDisabled) {
|
|
3133
|
-
e.preventDefault();
|
|
3134
|
-
e.stopPropagation();
|
|
3135
|
-
return;
|
|
3136
|
-
}
|
|
3137
|
-
menuProps.onClose && menuProps.onClose(e, 'backdropClick');
|
|
3138
|
-
!isDisabled && handleClick && handleClick(context);
|
|
3278
|
+
return (React__default.createElement(CollapsableMenuItem, __assign({ sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children === null || children === void 0 ? void 0 : children.map(renderChild(level + 1, isDisabled)) }, props),
|
|
3279
|
+
React__default.createElement("span", { style: style }, label)));
|
|
3139
3280
|
};
|
|
3140
|
-
return (React__default.createElement(CollapsableMenuItem, { sx: isDisabled && !children ? { cursor: 'not-allowed' } : {}, level: level, id: label, disabled: isDisabled, items: children?.map(renderChild(level + 1, isDisabled)), ...props },
|
|
3141
|
-
React__default.createElement("span", { style: style }, label)));
|
|
3142
3281
|
};
|
|
3143
|
-
return (React__default.createElement(Menu, {
|
|
3282
|
+
return (React__default.createElement(Menu, __assign({}, menuProps, { anchorOrigin: (menuProps === null || menuProps === void 0 ? void 0 : menuProps.anchorOrigin) || {
|
|
3144
3283
|
vertical: 'bottom',
|
|
3145
3284
|
horizontal: 'center',
|
|
3146
3285
|
}, transformOrigin: menuProps.transformOrigin || {
|
|
3147
3286
|
vertical: 'top',
|
|
3148
3287
|
horizontal: 'center',
|
|
3149
|
-
} }, menuItems.map(renderChild())));
|
|
3288
|
+
} }), menuItems.map(renderChild())));
|
|
3150
3289
|
};
|
|
3151
3290
|
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
},
|
|
3163
|
-
[theme.breakpoints.up('md')]: {
|
|
3164
|
-
minHeight: '100px',
|
|
3165
|
-
},
|
|
3166
|
-
fontFamily: 'Montserrat',
|
|
3167
|
-
fontWeight: 600,
|
|
3168
|
-
fontSize: '14px',
|
|
3169
|
-
},
|
|
3170
|
-
content: {
|
|
3171
|
-
display: 'flex',
|
|
3172
|
-
width: '100%',
|
|
3173
|
-
a: {
|
|
3174
|
-
':focus': {
|
|
3175
|
-
outlineColor: 'white',
|
|
3176
|
-
outlineOffset: '8px',
|
|
3291
|
+
var useFooterStyles = makeStyles()(function (theme) {
|
|
3292
|
+
var _a, _b, _c, _d, _e;
|
|
3293
|
+
return ({
|
|
3294
|
+
footer: (_a = {
|
|
3295
|
+
bottom: 0,
|
|
3296
|
+
width: '100%',
|
|
3297
|
+
marginTop: 'auto',
|
|
3298
|
+
display: 'flex',
|
|
3299
|
+
alignItems: 'center',
|
|
3300
|
+
backgroundColor: theme.palette.primary.main
|
|
3177
3301
|
},
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
flexDirection: 'column',
|
|
3181
|
-
padding: '0',
|
|
3182
|
-
a: {
|
|
3183
|
-
width: '150px',
|
|
3184
|
-
margin: '40px auto 40px auto',
|
|
3302
|
+
_a[theme.breakpoints.down('md')] = {
|
|
3303
|
+
minHeight: 'unset',
|
|
3185
3304
|
},
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
flexDirection: 'row',
|
|
3189
|
-
padding: '0 12px 0 12px',
|
|
3190
|
-
a: {
|
|
3191
|
-
marginLeft: '28px',
|
|
3305
|
+
_a[theme.breakpoints.up('md')] = {
|
|
3306
|
+
minHeight: '100px',
|
|
3192
3307
|
},
|
|
3308
|
+
_a.fontFamily = 'Montserrat',
|
|
3309
|
+
_a.fontWeight = 600,
|
|
3310
|
+
_a.fontSize = '14px',
|
|
3311
|
+
_a),
|
|
3312
|
+
content: (_b = {
|
|
3313
|
+
display: 'flex',
|
|
3314
|
+
width: '100%',
|
|
3315
|
+
a: {
|
|
3316
|
+
':focus': {
|
|
3317
|
+
outlineColor: 'white',
|
|
3318
|
+
outlineOffset: '8px',
|
|
3319
|
+
},
|
|
3320
|
+
}
|
|
3321
|
+
},
|
|
3322
|
+
_b[theme.breakpoints.down('md')] = {
|
|
3323
|
+
flexDirection: 'column',
|
|
3324
|
+
padding: '0',
|
|
3325
|
+
a: {
|
|
3326
|
+
width: '150px',
|
|
3327
|
+
margin: '40px auto 40px auto',
|
|
3328
|
+
},
|
|
3329
|
+
},
|
|
3330
|
+
_b[theme.breakpoints.up('md')] = {
|
|
3331
|
+
flexDirection: 'row',
|
|
3332
|
+
padding: '0 12px 0 12px',
|
|
3333
|
+
a: {
|
|
3334
|
+
marginLeft: '28px',
|
|
3335
|
+
},
|
|
3336
|
+
},
|
|
3337
|
+
_b),
|
|
3338
|
+
serviceNameText: (_c = {
|
|
3339
|
+
color: Colors.white,
|
|
3340
|
+
textAlign: 'center',
|
|
3341
|
+
display: 'block'
|
|
3342
|
+
},
|
|
3343
|
+
_c[theme.breakpoints.down('md')] = {
|
|
3344
|
+
marginBottom: '30px',
|
|
3345
|
+
},
|
|
3346
|
+
_c),
|
|
3347
|
+
list: (_d = {
|
|
3348
|
+
display: 'flex',
|
|
3349
|
+
flexDirection: 'row',
|
|
3350
|
+
justifyContent: 'center'
|
|
3351
|
+
},
|
|
3352
|
+
_d[theme.breakpoints.down('md')] = {
|
|
3353
|
+
marginBottom: '40px',
|
|
3354
|
+
flexWrap: 'wrap',
|
|
3355
|
+
height: '64px',
|
|
3356
|
+
},
|
|
3357
|
+
_d),
|
|
3358
|
+
item: (_e = {
|
|
3359
|
+
color: Colors.white,
|
|
3360
|
+
width: 'fit-content',
|
|
3361
|
+
margin: '0',
|
|
3362
|
+
height: '10px',
|
|
3363
|
+
gap: '10px',
|
|
3364
|
+
borderRight: "1px solid #7dbf9d"
|
|
3365
|
+
},
|
|
3366
|
+
_e[theme.breakpoints.down('md')] = {
|
|
3367
|
+
textAlign: 'center',
|
|
3368
|
+
width: 'filter-content',
|
|
3369
|
+
},
|
|
3370
|
+
_e['&:last-child'] = {
|
|
3371
|
+
border: '0 !important',
|
|
3372
|
+
},
|
|
3373
|
+
_e[':focus'] = {
|
|
3374
|
+
background: 'inherit',
|
|
3375
|
+
boxShadow: '0px 0px 0px 1px white',
|
|
3376
|
+
borderRadius: '2px',
|
|
3377
|
+
},
|
|
3378
|
+
_e),
|
|
3379
|
+
itemText: {
|
|
3380
|
+
padding: 0,
|
|
3381
|
+
margin: '0 auto',
|
|
3382
|
+
fontFamily: 'Montserrat',
|
|
3383
|
+
fontWeight: 400,
|
|
3384
|
+
fontSize: '14px',
|
|
3385
|
+
color: Colors.white,
|
|
3193
3386
|
},
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
marginBottom: '30px',
|
|
3201
|
-
},
|
|
3202
|
-
},
|
|
3203
|
-
list: {
|
|
3204
|
-
display: 'flex',
|
|
3205
|
-
flexDirection: 'row',
|
|
3206
|
-
justifyContent: 'center',
|
|
3207
|
-
[theme.breakpoints.down('md')]: {
|
|
3208
|
-
marginBottom: '40px',
|
|
3209
|
-
flexWrap: 'wrap',
|
|
3210
|
-
height: '64px',
|
|
3211
|
-
},
|
|
3212
|
-
},
|
|
3213
|
-
item: {
|
|
3214
|
-
color: Colors.white,
|
|
3215
|
-
width: 'fit-content',
|
|
3216
|
-
margin: '0',
|
|
3217
|
-
height: '10px',
|
|
3218
|
-
gap: '10px',
|
|
3219
|
-
borderRight: `1px solid #7dbf9d`,
|
|
3220
|
-
[theme.breakpoints.down('md')]: {
|
|
3221
|
-
textAlign: 'center',
|
|
3222
|
-
width: 'filter-content',
|
|
3223
|
-
},
|
|
3224
|
-
'&:last-child': {
|
|
3225
|
-
border: '0 !important',
|
|
3226
|
-
},
|
|
3227
|
-
':focus': {
|
|
3228
|
-
background: 'inherit',
|
|
3229
|
-
boxShadow: '0px 0px 0px 1px white',
|
|
3230
|
-
borderRadius: '2px',
|
|
3231
|
-
},
|
|
3232
|
-
},
|
|
3233
|
-
itemText: {
|
|
3234
|
-
padding: 0,
|
|
3235
|
-
margin: '0 auto',
|
|
3236
|
-
fontFamily: 'Montserrat',
|
|
3237
|
-
fontWeight: 400,
|
|
3238
|
-
fontSize: '14px',
|
|
3239
|
-
color: Colors.white,
|
|
3240
|
-
},
|
|
3241
|
-
itemBtn: {
|
|
3242
|
-
textDecoration: 'underline',
|
|
3243
|
-
textTransform: 'none',
|
|
3244
|
-
'&:hover': {
|
|
3245
|
-
backgroundColor: 'unset',
|
|
3387
|
+
itemBtn: {
|
|
3388
|
+
textDecoration: 'underline',
|
|
3389
|
+
textTransform: 'none',
|
|
3390
|
+
'&:hover': {
|
|
3391
|
+
backgroundColor: 'unset',
|
|
3392
|
+
},
|
|
3246
3393
|
},
|
|
3247
|
-
}
|
|
3248
|
-
})
|
|
3394
|
+
});
|
|
3395
|
+
});
|
|
3249
3396
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
}
|
|
3397
|
+
var Footer = function (_a) {
|
|
3398
|
+
var items = _a.items, serviceNameText = _a.serviceNameText, udirLink = _a.udirLink, udirLogo = _a.udirLogo;
|
|
3399
|
+
var classes = useFooterStyles().classes;
|
|
3400
|
+
var renderItem = function (item) {
|
|
3401
|
+
return item.onClickItem ? (React__default.createElement(Button, { className: classes.itemBtn.concat(' ' + classes.itemText), onClick: item.onClickItem }, item.label)) : (React__default.createElement(ListItemText, { className: classes.itemText, primary: item.label, primaryTypographyProps: {
|
|
3402
|
+
style: { fontSize: 14, fontFamily: 'Montserrat', fontWeight: 400 },
|
|
3403
|
+
} }));
|
|
3404
|
+
};
|
|
3255
3405
|
return (React__default.createElement(Box, { className: classes.footer, role: "contentinfo" },
|
|
3256
3406
|
React__default.createElement(Box, { className: classes.content },
|
|
3257
3407
|
React__default.createElement("a", { href: udirLink },
|
|
@@ -3262,29 +3412,29 @@ const Footer = ({ items, serviceNameText, udirLink, udirLogo, }) => {
|
|
|
3262
3412
|
paddingRight: '16px !important',
|
|
3263
3413
|
} },
|
|
3264
3414
|
React__default.createElement("span", { className: classes.serviceNameText }, serviceNameText),
|
|
3265
|
-
React__default.createElement(List, { className: classes.list }, items.map((item, i)
|
|
3415
|
+
React__default.createElement(List, { className: classes.list }, items.map(function (item, i) { return (React__default.createElement(ListItem, { key: i, classes: {
|
|
3266
3416
|
root: classes.item,
|
|
3267
3417
|
//button: onClickItem ? classes.itemBtn : undefined,
|
|
3268
3418
|
} }, item.render
|
|
3269
|
-
? item.render(()
|
|
3270
|
-
: renderItem(item)))))))));
|
|
3419
|
+
? item.render(function () { return renderItem(item); })
|
|
3420
|
+
: renderItem(item))); }))))));
|
|
3271
3421
|
};
|
|
3272
3422
|
|
|
3273
|
-
|
|
3423
|
+
var LinkList = function (props) { return (React.createElement(Box, { width: "100%", flexDirection: "column" },
|
|
3274
3424
|
React.createElement(Typography, { style: { fontSize: 24, color: Colors.black, marginBottom: 20 } }, props.title),
|
|
3275
|
-
React.createElement(List, null, props.pages.map((page)
|
|
3276
|
-
React.createElement(ListItem, { button: true, onClick: ()
|
|
3425
|
+
React.createElement(List, null, props.pages.map(function (page) { return (React.createElement(Box, { key: page.id },
|
|
3426
|
+
React.createElement(ListItem, { button: true, onClick: function () { return props.onPageClick(page); }, style: { padding: '12px 4px' } },
|
|
3277
3427
|
React.createElement(ListItemText, { primary: page.label, primaryTypographyProps: {
|
|
3278
3428
|
color: 'primary',
|
|
3279
3429
|
style: { fontSize: 18 },
|
|
3280
3430
|
} }),
|
|
3281
3431
|
React.createElement(ListItemIcon, { style: { justifyContent: 'flex-end' } },
|
|
3282
3432
|
React.createElement(ArrowForward, { color: "primary" }))),
|
|
3283
|
-
React.createElement(Divider, null)))))));
|
|
3433
|
+
React.createElement(Divider, null))); })))); };
|
|
3284
3434
|
|
|
3285
|
-
|
|
3435
|
+
var useStyles$e = makeStyles()({
|
|
3286
3436
|
container: {
|
|
3287
|
-
border:
|
|
3437
|
+
border: "1px solid ".concat(Colors.lightGrey),
|
|
3288
3438
|
height: 'fit-content',
|
|
3289
3439
|
width: 'fit-content',
|
|
3290
3440
|
},
|
|
@@ -3296,30 +3446,32 @@ const useStyles$e = makeStyles()({
|
|
|
3296
3446
|
},
|
|
3297
3447
|
});
|
|
3298
3448
|
|
|
3299
|
-
|
|
3300
|
-
|
|
3449
|
+
var ContainedLinkList = function (props) {
|
|
3450
|
+
var classes = useStyles$e().classes;
|
|
3301
3451
|
return (React.createElement(Box, { className: classes.container, style: props.style },
|
|
3302
3452
|
React.createElement(Typography, { className: classes.title }, props.title),
|
|
3303
|
-
React.createElement(List, { style: { padding: 0 } }, props.pages.map((page)
|
|
3304
|
-
React.createElement(ListItemButton, { onClick: ()
|
|
3453
|
+
React.createElement(List, { style: { padding: 0 } }, props.pages.map(function (page) { return (React.createElement(ListItem, { divider: true, key: page.id, disablePadding: true },
|
|
3454
|
+
React.createElement(ListItemButton, { onClick: function () { return props.onPageClick(page); } },
|
|
3305
3455
|
page.linkIcon && React.createElement(ListItemIcon$1, null, page.linkIcon),
|
|
3306
|
-
React.createElement(ListItemText, { primary: page.label }))))))));
|
|
3456
|
+
React.createElement(ListItemText, { primary: page.label })))); }))));
|
|
3307
3457
|
};
|
|
3308
3458
|
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3459
|
+
var OverflowTooltip = /** @class */ (function (_super) {
|
|
3460
|
+
__extends(OverflowTooltip, _super);
|
|
3461
|
+
function OverflowTooltip(props) {
|
|
3462
|
+
var _this = _super.call(this, props) || this;
|
|
3463
|
+
_this.nodeRef = React.createRef();
|
|
3464
|
+
_this.state = { overflow: false };
|
|
3465
|
+
return _this;
|
|
3314
3466
|
}
|
|
3315
|
-
componentDidMount() {
|
|
3316
|
-
|
|
3467
|
+
OverflowTooltip.prototype.componentDidMount = function () {
|
|
3468
|
+
var element = this.nodeRef.current;
|
|
3317
3469
|
if (element) {
|
|
3318
|
-
|
|
3319
|
-
this.setState({ overflow });
|
|
3470
|
+
var overflow = element.clientWidth < element.scrollWidth;
|
|
3471
|
+
this.setState({ overflow: overflow });
|
|
3320
3472
|
}
|
|
3321
|
-
}
|
|
3322
|
-
render() {
|
|
3473
|
+
};
|
|
3474
|
+
OverflowTooltip.prototype.render = function () {
|
|
3323
3475
|
if (this.state.overflow || this.props.force) {
|
|
3324
3476
|
return (React.createElement(Tooltip, { placement: "left", title: this.props.title || '' },
|
|
3325
3477
|
React.createElement("div", { style: { display: 'unset' }, ref: this.nodeRef }, this.props.children)));
|
|
@@ -3327,50 +3479,56 @@ class OverflowTooltip extends React.Component {
|
|
|
3327
3479
|
else {
|
|
3328
3480
|
return React.createElement("div", { ref: this.nodeRef }, this.props.children);
|
|
3329
3481
|
}
|
|
3330
|
-
}
|
|
3331
|
-
|
|
3482
|
+
};
|
|
3483
|
+
return OverflowTooltip;
|
|
3484
|
+
}(React.Component));
|
|
3332
3485
|
|
|
3333
|
-
|
|
3486
|
+
var CellValue = styled('span')({
|
|
3334
3487
|
overflow: 'hidden',
|
|
3335
3488
|
textOverflow: 'ellipsis',
|
|
3336
3489
|
display: '-webkit-box',
|
|
3337
3490
|
WebkitBoxOrient: 'vertical',
|
|
3338
3491
|
});
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3492
|
+
var GrepTableRow$1 = function (_a) {
|
|
3493
|
+
var row = _a.row, column = _a.column, expanded = _a.expanded, props = __rest$1(_a, ["row", "column", "expanded"]);
|
|
3494
|
+
var forceTooltip = column.forceTooltip, getTooltip = column.getTooltip, getCell = column.getCell, lang = column.lang, _b = column.lines, lines = _b === void 0 ? function () { return (expanded ? undefined : 1); } : _b;
|
|
3495
|
+
var padding = column.padding;
|
|
3496
|
+
var value = (React__default.createElement(CellValue, { style: { WebkitLineClamp: lines(row) }, lang: typeof lang === 'string' ? lang : lang ? lang(row) : '' }, getCell(row)));
|
|
3343
3497
|
if (forceTooltip || getTooltip) {
|
|
3344
|
-
return (React__default.createElement(TableCell, { padding: padding,
|
|
3498
|
+
return (React__default.createElement(TableCell, __assign({ padding: padding }, props),
|
|
3345
3499
|
React__default.createElement(OverflowTooltip, { force: forceTooltip, title: getTooltip ? getTooltip(row) : value }, value)));
|
|
3346
3500
|
}
|
|
3347
|
-
return (React__default.createElement(TableCell, { padding: padding,
|
|
3501
|
+
return (React__default.createElement(TableCell, __assign({ padding: padding }, props), value));
|
|
3348
3502
|
};
|
|
3349
3503
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
return (React__default.createElement(
|
|
3504
|
+
var GrepTableRow = function (_a) {
|
|
3505
|
+
var row = _a.row, columns = _a.columns, selected = _a.selected, expanded = _a.expanded, variant = _a.variant; _a.clickable; _a.height; var underlineOnFocus = _a.underlineOnFocus, props = __rest$1(_a, ["row", "columns", "selected", "expanded", "variant", "clickable", "height", "underlineOnFocus"]);
|
|
3506
|
+
var render = function (column, index) { return (React__default.createElement(GrepTableRow$1, __assign({ key: index, expanded: expanded }, { column: column, row: row, variant: variant, selected: selected }))); };
|
|
3507
|
+
return (React__default.createElement(TableRow, __assign({ sx: {
|
|
3353
3508
|
':focus': { textDecoration: underlineOnFocus ? 'underline' : 'none' },
|
|
3354
|
-
}, tabIndex: props.tabIndex,
|
|
3509
|
+
}, tabIndex: props.tabIndex }, __assign({ selected: selected }, props)), columns.map(render)));
|
|
3355
3510
|
};
|
|
3356
3511
|
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3512
|
+
var usePaginationActionStyles = makeStyles()(function (_a) {
|
|
3513
|
+
var palette = _a.palette;
|
|
3514
|
+
return ({
|
|
3515
|
+
button: {
|
|
3516
|
+
minWidth: '18px',
|
|
3517
|
+
minHeight: '20px',
|
|
3518
|
+
padding: '0 6px',
|
|
3519
|
+
margin: '0 8px',
|
|
3520
|
+
borderRadius: '2px',
|
|
3521
|
+
fontSize: 12,
|
|
3522
|
+
backgroundColor: palette.primary.main,
|
|
3523
|
+
},
|
|
3524
|
+
textButton: {
|
|
3525
|
+
textTransform: 'capitalize',
|
|
3526
|
+
fontWeight: 'initial',
|
|
3527
|
+
fontSize: 12,
|
|
3528
|
+
},
|
|
3529
|
+
});
|
|
3530
|
+
});
|
|
3531
|
+
var usePaginationStyles = makeStyles()({
|
|
3374
3532
|
toolbar: {
|
|
3375
3533
|
padding: 0,
|
|
3376
3534
|
width: '100%',
|
|
@@ -3389,39 +3547,42 @@ const usePaginationStyles = makeStyles()({
|
|
|
3389
3547
|
display: 'none',
|
|
3390
3548
|
},
|
|
3391
3549
|
});
|
|
3392
|
-
|
|
3393
|
-
|
|
3550
|
+
var useTableHeaderStyles = makeStyles()(function (_theme, _a) {
|
|
3551
|
+
var column = _a.column;
|
|
3552
|
+
var width = column.width
|
|
3394
3553
|
? typeof column.width === 'number'
|
|
3395
|
-
?
|
|
3554
|
+
? "".concat(column.width, "%")
|
|
3396
3555
|
: column.width
|
|
3397
3556
|
: undefined;
|
|
3398
3557
|
return {
|
|
3399
3558
|
th: {
|
|
3400
|
-
width,
|
|
3559
|
+
width: width,
|
|
3401
3560
|
fontSize: 14,
|
|
3402
3561
|
},
|
|
3403
3562
|
};
|
|
3404
3563
|
});
|
|
3405
3564
|
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3565
|
+
var TableHeaderCell = function (_a) {
|
|
3566
|
+
var column = _a.column, onSortBy = _a.onSortBy, direction = _a.direction, active = _a.active, children = _a.children, _b = _a.empty, empty = _b === void 0 ? false : _b, props = __rest$1(_a, ["column", "onSortBy", "direction", "active", "children", "empty"]);
|
|
3567
|
+
var classes = useTableHeaderStyles({ column: column }).classes;
|
|
3568
|
+
var sortable = !!(onSortBy && column.sortable);
|
|
3409
3569
|
if (sortable && !empty) {
|
|
3410
|
-
return (React__default.createElement(TableCell, { variant: empty ? 'body' : 'head', className: classes.th,
|
|
3570
|
+
return (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props),
|
|
3411
3571
|
React__default.createElement(TableSortLabel, { active: active, direction: direction }, children)));
|
|
3412
3572
|
}
|
|
3413
|
-
return empty ? (React__default.createElement("td", { className: classes.th }, children)) : (React__default.createElement(TableCell, { variant: empty ? 'body' : 'head', className: classes.th,
|
|
3573
|
+
return empty ? (React__default.createElement("td", { className: classes.th }, children)) : (React__default.createElement(TableCell, __assign({ variant: empty ? 'body' : 'head', className: classes.th }, props), children));
|
|
3414
3574
|
};
|
|
3415
3575
|
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3576
|
+
var TableHeader = function (_a) {
|
|
3577
|
+
var columns = _a.columns, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, dropdownItems = _a.dropdownItems, props = __rest$1(_a, ["columns", "sortBy", "sortDirection", "onSortBy", "dropdownItems"]);
|
|
3578
|
+
var headerColumns = dropdownItems
|
|
3579
|
+
? columns.concat([{ label: '', width: '48px', getCell: function () { return ''; } }])
|
|
3419
3580
|
: columns;
|
|
3420
|
-
return (React__default.createElement(TableHead, {
|
|
3421
|
-
React__default.createElement(TableRow, null, headerColumns.map((column, index)
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
return (React__default.createElement(TableHeaderCell, { key: index, empty: !label, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: ()
|
|
3581
|
+
return (React__default.createElement(TableHead, __assign({}, props),
|
|
3582
|
+
React__default.createElement(TableRow, null, headerColumns.map(function (column, index) {
|
|
3583
|
+
var sortable = !!(onSortBy && column.sortable);
|
|
3584
|
+
var label = column.label, colDef = column.colDef;
|
|
3585
|
+
return (React__default.createElement(TableHeaderCell, { key: index, empty: !label, column: column, direction: sortDirection, active: sortable ? sortBy === colDef : undefined, onClick: function () { return sortable && onSortBy(column); }, onKeyDown: onActivation(function (e) {
|
|
3425
3586
|
if (sortable) {
|
|
3426
3587
|
e.preventDefault();
|
|
3427
3588
|
onSortBy(column);
|
|
@@ -3430,19 +3591,23 @@ const TableHeader = ({ columns, sortBy, sortDirection, onSortBy, dropdownItems,
|
|
|
3430
3591
|
}))));
|
|
3431
3592
|
};
|
|
3432
3593
|
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3594
|
+
var PaginationActions = function (_a) {
|
|
3595
|
+
var count = _a.count, page = _a.page, rowsPerPage = _a.rowsPerPage, onPageChange = _a.onPageChange;
|
|
3596
|
+
var classes = usePaginationActionStyles().classes;
|
|
3597
|
+
var getPageNumbers = function (count, currentPage, rowsPerPage) {
|
|
3598
|
+
var pageNumbers = [];
|
|
3599
|
+
var pageCount = Math.ceil(count / rowsPerPage);
|
|
3600
|
+
var _loop_1 = function (i) {
|
|
3439
3601
|
pageNumbers.push(React.createElement(Button, { key: i, className: classes.button, style: currentPage === i
|
|
3440
3602
|
? {
|
|
3441
3603
|
color: 'white',
|
|
3442
3604
|
}
|
|
3443
3605
|
: {
|
|
3444
3606
|
backgroundColor: Colors.white,
|
|
3445
|
-
}, onClick: (e)
|
|
3607
|
+
}, onClick: function (e) { return onPageChange(e, i); }, disabled: currentPage === i }, i + 1));
|
|
3608
|
+
};
|
|
3609
|
+
for (var i = 0; i < pageCount; i++) {
|
|
3610
|
+
_loop_1(i);
|
|
3446
3611
|
}
|
|
3447
3612
|
if (currentPage >= 2 && currentPage < pageCount - 2) {
|
|
3448
3613
|
return pageNumbers.slice(currentPage - 2, currentPage + 3);
|
|
@@ -3452,14 +3617,14 @@ const PaginationActions = ({ count, page, rowsPerPage, onPageChange }) => {
|
|
|
3452
3617
|
: pageNumbers.slice(pageCount - 5, pageCount);
|
|
3453
3618
|
};
|
|
3454
3619
|
return (React.createElement("div", { style: { gridArea: 'right', justifySelf: 'end' } },
|
|
3455
|
-
React.createElement(Button, { className: classes.textButton, onClick: (e)
|
|
3620
|
+
React.createElement(Button, { className: classes.textButton, onClick: function (e) { return onPageChange(e, page - 1); }, disabled: page === 0, "aria-label": "Previous Page" }, "Forrige"),
|
|
3456
3621
|
getPageNumbers(count, page, rowsPerPage),
|
|
3457
|
-
React.createElement(Button, { className: classes.textButton, onClick: (e)
|
|
3622
|
+
React.createElement(Button, { className: classes.textButton, onClick: function (e) { return onPageChange(e, page + 1); }, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "Next Page" }, "Neste")));
|
|
3458
3623
|
};
|
|
3459
3624
|
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
return (React__default.createElement(TablePagination, { classes: classes, rowsPerPageOptions: props.rowsPerPageOptions, SelectProps: {
|
|
3625
|
+
var GrepTablePagination = function (props) {
|
|
3626
|
+
var classes = usePaginationStyles().classes;
|
|
3627
|
+
return (React__default.createElement(TablePagination, __assign({ classes: classes, rowsPerPageOptions: props.rowsPerPageOptions, SelectProps: {
|
|
3463
3628
|
inputProps: {
|
|
3464
3629
|
title: 'Velg antall elementer',
|
|
3465
3630
|
},
|
|
@@ -3467,31 +3632,40 @@ const GrepTablePagination = (props) => {
|
|
|
3467
3632
|
gridArea: 'left',
|
|
3468
3633
|
justifySelf: 'start',
|
|
3469
3634
|
},
|
|
3470
|
-
}, ActionsComponent: (actions)
|
|
3635
|
+
}, ActionsComponent: function (actions) { return (React__default.createElement(PaginationActions, __assign({}, actions))); } }, props)));
|
|
3471
3636
|
};
|
|
3472
3637
|
|
|
3473
|
-
|
|
3638
|
+
var GrepTablePlaceholder = function (_a) {
|
|
3639
|
+
var columns = _a.columns, padding = _a.padding, _b = _a.text, text = _b === void 0 ? 'Tabellen er tom.' : _b;
|
|
3474
3640
|
return (React__default.createElement(TableRow, null,
|
|
3475
3641
|
React__default.createElement(TableCell, { padding: padding, colSpan: columns.length }, text)));
|
|
3476
3642
|
};
|
|
3477
3643
|
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
visibility: showHeader ? 'visible' : 'collapse',
|
|
3486
|
-
},
|
|
3487
|
-
body: {
|
|
3488
|
-
'&:focus': {
|
|
3489
|
-
outline: 'none',
|
|
3644
|
+
var useStyles$d = makeStyles()(function (theme, _a) {
|
|
3645
|
+
var showHeader = _a.showHeader, outlined = _a.outlined;
|
|
3646
|
+
return ({
|
|
3647
|
+
table: {
|
|
3648
|
+
border: outlined ? "1px solid ".concat(theme.palette.divider) : 'none',
|
|
3649
|
+
borderCollapse: outlined ? 'separate' : 'collapse',
|
|
3650
|
+
tableLayout: 'auto',
|
|
3490
3651
|
},
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3652
|
+
header: {
|
|
3653
|
+
visibility: showHeader ? 'visible' : 'collapse',
|
|
3654
|
+
},
|
|
3655
|
+
body: {
|
|
3656
|
+
'&:focus': {
|
|
3657
|
+
outline: 'none',
|
|
3658
|
+
},
|
|
3659
|
+
},
|
|
3660
|
+
});
|
|
3661
|
+
});
|
|
3662
|
+
var containsFocus = function (el, tag) {
|
|
3663
|
+
if (tag === void 0) { tag = '*'; }
|
|
3664
|
+
return Array.from(el.getElementsByTagName(tag)).some(function (el) { return el === document.activeElement; });
|
|
3665
|
+
};
|
|
3666
|
+
var getElementIndex = function (el) {
|
|
3667
|
+
return Number(el.getAttribute('data-index') || -1);
|
|
3668
|
+
};
|
|
3495
3669
|
/**
|
|
3496
3670
|
* Since Grep-Table is so tightly intregrated into LPU and Admin some core logic could not be fixed
|
|
3497
3671
|
* Still works but still messy
|
|
@@ -3499,15 +3673,16 @@ const getElementIndex = (el) => Number(el.getAttribute('data-index') || -1);
|
|
|
3499
3673
|
* @todo enhance page handling
|
|
3500
3674
|
*
|
|
3501
3675
|
*/
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3676
|
+
var GrepTable = function (_a) {
|
|
3677
|
+
var placeholderText = _a.placeholderText, dropdownItems = _a.dropdownItems, isRowDisabled = _a.isRowDisabled, pagination = _a.pagination, outlined = _a.outlined, columns = _a.columns, header = _a.header, data = _a.data, onSelectedRowChange = _a.onSelectedRowChange, sortBy = _a.sortBy, sortDirection = _a.sortDirection, onSortBy = _a.onSortBy, onRowClick = _a.onRowClick, size = _a.size, caption = _a.caption, stickyHeader = _a.stickyHeader, padding = _a.padding, _b = _a.disableSelectOnClick, disableSelectOnClick = _b === void 0 ? false : _b, menuButtonLabel = _a.menuButtonLabel, underlineOnFocus = _a.underlineOnFocus, rowTabIndex = _a.rowTabIndex, rowStyle = _a.rowStyle, _c = _a.rowsPerPageOptions, rowsPerPageOptions = _c === void 0 ? [5, 10, 25, 50] : _c, props = __rest$1(_a, ["placeholderText", "dropdownItems", "isRowDisabled", "pagination", "outlined", "columns", "header", "data", "onSelectedRowChange", "sortBy", "sortDirection", "onSortBy", "onRowClick", "size", "caption", "stickyHeader", "padding", "disableSelectOnClick", "menuButtonLabel", "underlineOnFocus", "rowTabIndex", "rowStyle", "rowsPerPageOptions"]);
|
|
3678
|
+
var _d = __read(React__default.useState(props.rowsPerPage || 10), 2), rowsPerPage = _d[0], setRowsPerPage = _d[1];
|
|
3679
|
+
var _e = __read(React__default.useState(null), 2), menuAnchor = _e[0], setMenuAnchor = _e[1];
|
|
3680
|
+
var _f = __read(React__default.useState(0), 2), currentPage = _f[0], _setCurrentPage = _f[1];
|
|
3681
|
+
var _g = __read(React__default.useState(), 2), selectedRowIndex = _g[0], _setSelectedRowIndex = _g[1];
|
|
3682
|
+
var _h = __read(React__default.useState(), 2), expandedRowIndex = _h[0], _setExpandedRowIndex = _h[1];
|
|
3683
|
+
var _j = __read(React__default.useState(), 2), dropdownContext = _j[0], setDropdownContext = _j[1];
|
|
3684
|
+
var selectedRow = data[selectedRowIndex] || null;
|
|
3685
|
+
var setCurrentPage = useCallback$1(function (index, rowIndex, shouldExpand) {
|
|
3511
3686
|
index = pagination && index >= 0 ? index : 0;
|
|
3512
3687
|
_setCurrentPage(index);
|
|
3513
3688
|
_setSelectedRowIndex(rowIndex);
|
|
@@ -3521,21 +3696,24 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
3521
3696
|
rowsPerPage,
|
|
3522
3697
|
pagination,
|
|
3523
3698
|
]);
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3699
|
+
var setSelectedRowIndex = function (index, shouldExpand) {
|
|
3700
|
+
if (shouldExpand === void 0) { shouldExpand = true; }
|
|
3701
|
+
var hasIndexChanged = index === selectedRowIndex;
|
|
3702
|
+
var pageIndex = Math.floor(index / rowsPerPage);
|
|
3527
3703
|
setCurrentPage(pageIndex, index, shouldExpand);
|
|
3528
3704
|
if (hasIndexChanged && onSelectedRowChange) {
|
|
3529
3705
|
onSelectedRowChange(data[index]);
|
|
3530
3706
|
}
|
|
3531
3707
|
};
|
|
3532
|
-
|
|
3708
|
+
var setSelectedElement = function (el, shouldExpand) {
|
|
3709
|
+
if (shouldExpand === void 0) { shouldExpand = true; }
|
|
3533
3710
|
setSelectedRowIndex(getElementIndex(el), shouldExpand);
|
|
3534
3711
|
};
|
|
3535
|
-
|
|
3712
|
+
var tableRef = React__default.useRef(null);
|
|
3536
3713
|
// focus selected row first tabable item
|
|
3537
|
-
React__default.useEffect(()
|
|
3538
|
-
|
|
3714
|
+
React__default.useEffect(function () {
|
|
3715
|
+
var _a;
|
|
3716
|
+
var rowTab = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-index=\"".concat(selectedRowIndex, "\"]"));
|
|
3539
3717
|
if (!rowTab)
|
|
3540
3718
|
return;
|
|
3541
3719
|
if (!containsFocus(rowTab)) {
|
|
@@ -3544,76 +3722,70 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
3544
3722
|
}
|
|
3545
3723
|
}
|
|
3546
3724
|
}, [tableRef, selectedRowIndex]);
|
|
3547
|
-
React__default.useMemo(()
|
|
3725
|
+
React__default.useMemo(function () {
|
|
3548
3726
|
setCurrentPage(0);
|
|
3549
3727
|
}, [data.length, setCurrentPage]);
|
|
3550
|
-
|
|
3551
|
-
|
|
3728
|
+
var _openDropdown = function (e, row) {
|
|
3729
|
+
var onContextIdChanged = props.onContextIdChanged;
|
|
3552
3730
|
if (onContextIdChanged) {
|
|
3553
3731
|
onContextIdChanged(row);
|
|
3554
3732
|
}
|
|
3555
3733
|
setDropdownContext(row);
|
|
3556
3734
|
setMenuAnchor(e.currentTarget);
|
|
3557
3735
|
};
|
|
3558
|
-
|
|
3559
|
-
|
|
3736
|
+
var _handleRowClick = useCallback$1(function (row) {
|
|
3737
|
+
var disabled = isRowDisabled && isRowDisabled(row);
|
|
3560
3738
|
!disabled && onRowClick && onRowClick(row);
|
|
3561
3739
|
}, [onRowClick]);
|
|
3562
|
-
|
|
3740
|
+
var _handlePageChange = function (event, newPage) {
|
|
3563
3741
|
event && event.preventDefault();
|
|
3564
3742
|
setCurrentPage(newPage);
|
|
3565
3743
|
};
|
|
3566
|
-
|
|
3744
|
+
var _handleChangeRowsPerPage = function (event) {
|
|
3567
3745
|
setRowsPerPage(Number(event.target.value));
|
|
3568
3746
|
};
|
|
3569
|
-
|
|
3747
|
+
var _handleMenuClose = function () {
|
|
3570
3748
|
setMenuAnchor(null);
|
|
3571
3749
|
};
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3750
|
+
var _renderCellButton = function (row) {
|
|
3751
|
+
var menuDisabled = props.menuDisabled, menuTooltip = props.menuTooltip;
|
|
3752
|
+
var disabled = menuDisabled && menuDisabled(row);
|
|
3753
|
+
var tooltip = menuTooltip ? menuTooltip(row) : '';
|
|
3576
3754
|
return (React__default.createElement(Tooltip, { title: tooltip, placement: "bottom" },
|
|
3577
3755
|
React__default.createElement("div", { style: { display: 'flex', justifyContent: 'end' } },
|
|
3578
|
-
React__default.createElement(IconButton, { disableTouchRipple: true, disabled: disabled, style: { float: 'right' }, onMouseDown: (e)
|
|
3756
|
+
React__default.createElement(IconButton, { disableTouchRipple: true, disabled: disabled, style: { float: 'right' }, onMouseDown: function (e) {
|
|
3579
3757
|
e.preventDefault();
|
|
3580
3758
|
e.stopPropagation();
|
|
3581
|
-
}, onClick: (e)
|
|
3759
|
+
}, onClick: function (e) {
|
|
3582
3760
|
_openDropdown(e, row);
|
|
3583
|
-
}, onKeyDown: (e)
|
|
3761
|
+
}, onKeyDown: function (e) {
|
|
3584
3762
|
switch (e.which) {
|
|
3585
3763
|
case Key_enum.Key.Enter:
|
|
3586
3764
|
// dont show dropdown
|
|
3587
3765
|
e.preventDefault();
|
|
3588
3766
|
break;
|
|
3589
3767
|
}
|
|
3590
|
-
}, tabIndex: 0, size: "large", "aria-label": menuButtonLabel
|
|
3768
|
+
}, tabIndex: 0, size: "large", "aria-label": menuButtonLabel !== null && menuButtonLabel !== void 0 ? menuButtonLabel : 'Åpne meny' },
|
|
3591
3769
|
React__default.createElement(MoreVert, null)))));
|
|
3592
3770
|
};
|
|
3593
|
-
|
|
3594
|
-
|
|
3771
|
+
var getRowStyle = function (row, index, clickableRows, disabled) {
|
|
3772
|
+
var style = { cursor: clickableRows && !disabled ? 'pointer' : '' };
|
|
3595
3773
|
if (typeof rowStyle === "function") {
|
|
3596
|
-
style = {
|
|
3597
|
-
...style,
|
|
3598
|
-
...rowStyle(row, index)
|
|
3599
|
-
};
|
|
3774
|
+
style = __assign(__assign({}, style), rowStyle(row, index));
|
|
3600
3775
|
}
|
|
3601
3776
|
else if (rowStyle) {
|
|
3602
|
-
style = {
|
|
3603
|
-
...style,
|
|
3604
|
-
...rowStyle
|
|
3605
|
-
};
|
|
3777
|
+
style = __assign(__assign({}, style), rowStyle);
|
|
3606
3778
|
}
|
|
3607
3779
|
return style;
|
|
3608
3780
|
};
|
|
3609
|
-
|
|
3610
|
-
|
|
3781
|
+
var _renderRow = function (row, index) {
|
|
3782
|
+
var rowColumns = dropdownItems
|
|
3611
3783
|
? columns.concat([{ getCell: _renderCellButton, padding: 'none' }])
|
|
3612
3784
|
: columns;
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex
|
|
3785
|
+
var clickableRows = !!onRowClick;
|
|
3786
|
+
var disabled = isRowDisabled && isRowDisabled(row);
|
|
3787
|
+
var rowIndex = index + currentPage * rowsPerPage;
|
|
3788
|
+
return (React__default.createElement(GrepTableRow, { key: rowIndex, "data-index": rowIndex, tabIndex: rowTabIndex !== null && rowTabIndex !== void 0 ? rowTabIndex : 0, hover: clickableRows, selected: rowIndex === selectedRowIndex, expanded: rowIndex === expandedRowIndex, clickable: clickableRows, onMouseDown: function (e) {
|
|
3617
3789
|
if (e.target.type === 'checkbox') {
|
|
3618
3790
|
e.preventDefault();
|
|
3619
3791
|
e.stopPropagation();
|
|
@@ -3625,16 +3797,16 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
3625
3797
|
_handleRowClick(row);
|
|
3626
3798
|
}
|
|
3627
3799
|
}
|
|
3628
|
-
}, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: (e)
|
|
3800
|
+
}, columns: rowColumns, row: row, style: getRowStyle(row, index, clickableRows, disabled), onFocus: function (e) {
|
|
3629
3801
|
if (selectedRowIndex !== rowIndex) {
|
|
3630
3802
|
setSelectedElement(e.currentTarget);
|
|
3631
3803
|
}
|
|
3632
3804
|
}, underlineOnFocus: underlineOnFocus }));
|
|
3633
3805
|
};
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3806
|
+
var onKey = function (e) {
|
|
3807
|
+
var maxIndex = data.length - 1;
|
|
3808
|
+
var moveSelectedRow = function (steps) {
|
|
3809
|
+
var i = (selectedRowIndex || 0) + steps;
|
|
3638
3810
|
if (i >= 0 && i <= maxIndex) {
|
|
3639
3811
|
setSelectedRowIndex(i);
|
|
3640
3812
|
}
|
|
@@ -3661,7 +3833,7 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
3661
3833
|
setSelectedRowIndex(maxIndex);
|
|
3662
3834
|
break;
|
|
3663
3835
|
case Key_enum.Key.Tab:
|
|
3664
|
-
requestAnimationFrame(()
|
|
3836
|
+
requestAnimationFrame(function () {
|
|
3665
3837
|
// check is any children still has focus
|
|
3666
3838
|
!containsFocus(tableRef.current) && setSelectedRowIndex(-1);
|
|
3667
3839
|
});
|
|
@@ -3671,53 +3843,57 @@ const GrepTable = ({ placeholderText, dropdownItems, isRowDisabled, pagination,
|
|
|
3671
3843
|
break;
|
|
3672
3844
|
}
|
|
3673
3845
|
};
|
|
3674
|
-
|
|
3846
|
+
var rows = pagination
|
|
3675
3847
|
? data.slice(currentPage * rowsPerPage, currentPage * rowsPerPage + rowsPerPage)
|
|
3676
3848
|
: data;
|
|
3677
|
-
|
|
3849
|
+
var classes = useStyles$d({ outlined: outlined, showHeader: header }).classes;
|
|
3678
3850
|
return (React__default.createElement(TableContainer, { sx: props.style },
|
|
3679
3851
|
React__default.createElement(Table, { className: classes.table, size: size, stickyHeader: stickyHeader, padding: padding },
|
|
3680
3852
|
caption && React__default.createElement("caption", null, caption),
|
|
3681
3853
|
React__default.createElement(TableHeader, { className: classes.header, columns: columns, sortBy: sortBy, sortDirection: sortDirection, onSortBy: onSortBy, dropdownItems: dropdownItems }),
|
|
3682
3854
|
React__default.createElement(TableBody, { ref: tableRef, className: classes.body, onKeyDown: onKey }, data.length ? (rows.map(_renderRow)) : (React__default.createElement(GrepTablePlaceholder, { padding: padding, columns: columns, text: placeholderText }))),
|
|
3683
3855
|
React__default.createElement(TableFooter, null, pagination && (React__default.createElement(TableRow, null,
|
|
3684
|
-
React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, rowsPerPageOptions: rowsPerPageOptions, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: (
|
|
3856
|
+
React__default.createElement(GrepTablePagination, { page: currentPage, count: data.length, rowsPerPage: rowsPerPage, onPageChange: _handlePageChange, rowsPerPageOptions: rowsPerPageOptions, onRowsPerPageChange: _handleChangeRowsPerPage, labelRowsPerPage: '', labelDisplayedRows: function (_a) {
|
|
3857
|
+
var from = _a.from, to = _a.to, count = _a.count;
|
|
3858
|
+
return "Viser ".concat(from, "-").concat(to, " av ").concat(count);
|
|
3859
|
+
} }))))),
|
|
3685
3860
|
dropdownItems && dropdownContext && (React__default.createElement(DropdownMenu, { open: !!menuAnchor, context: dropdownContext, anchorEl: menuAnchor, menuItems: dropdownItems, onClose: _handleMenuClose }))));
|
|
3686
3861
|
};
|
|
3687
3862
|
|
|
3688
|
-
|
|
3863
|
+
var useStyles$c = makeStyles()({
|
|
3689
3864
|
container: {
|
|
3690
|
-
border:
|
|
3865
|
+
border: "1px solid ".concat(Colors.lightGrey),
|
|
3691
3866
|
height: 'fit-content',
|
|
3692
3867
|
flex: 'auto',
|
|
3693
3868
|
},
|
|
3694
3869
|
title: { fontSize: 24, padding: 20, color: Colors.black },
|
|
3695
3870
|
});
|
|
3696
3871
|
|
|
3697
|
-
|
|
3698
|
-
|
|
3872
|
+
var GrepTableCard = function (props) {
|
|
3873
|
+
var classes = useStyles$c().classes;
|
|
3699
3874
|
return (React.createElement(Box, { className: classes.container, style: props.style },
|
|
3700
3875
|
React.createElement(Typography, { className: classes.title }, props.title),
|
|
3701
|
-
React.createElement(GrepTable, {
|
|
3876
|
+
React.createElement(GrepTable, __assign({}, props, { header: true }))));
|
|
3702
3877
|
};
|
|
3703
3878
|
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3879
|
+
var LoadingOverlay = function (_a) {
|
|
3880
|
+
var _b = _a.overlay, overlay = _b === void 0 ? 'rgba(255,255,255, .5)' : _b, show = _a.show, children = _a.children, minTime = _a.minTime, zIndex = _a.zIndex, sx = _a.sx, box = __rest$1(_a, ["overlay", "show", "children", "minTime", "zIndex", "sx"]);
|
|
3881
|
+
var _c = __read(useState(show), 2), enabled = _c[0], setEnabled = _c[1];
|
|
3882
|
+
useEffect(function () {
|
|
3883
|
+
var timeout = setTimeout(function () { return setEnabled(show); }, show ? 0 : minTime);
|
|
3884
|
+
return function () { return clearTimeout(timeout); };
|
|
3709
3885
|
}, [show, minTime, setEnabled]);
|
|
3710
3886
|
return (React__default.createElement(Box, { position: "relative", display: "block", overflow: show ? 'hidden' : '' },
|
|
3711
3887
|
children,
|
|
3712
|
-
React__default.createElement(Box, { position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? (zIndex ? zIndex : 999) : -999, style: {
|
|
3888
|
+
React__default.createElement(Box, __assign({ position: "absolute", display: "flex", alignItems: "center", justifyContent: "center", top: 0, left: 0, height: "100%", width: "100%", zIndex: enabled ? (zIndex ? zIndex : 999) : -999, style: {
|
|
3713
3889
|
backgroundColor: overlay,
|
|
3714
3890
|
opacity: show ? 1 : 0,
|
|
3715
|
-
transition:
|
|
3716
|
-
}, sx: sx,
|
|
3891
|
+
transition: "opacity ".concat(show ? 0 : minTime, "ms ease"),
|
|
3892
|
+
}, sx: sx }, box),
|
|
3717
3893
|
React__default.createElement(CircularProgress, { "aria-label": "Laster inn" }))));
|
|
3718
3894
|
};
|
|
3719
3895
|
|
|
3720
|
-
|
|
3896
|
+
var useStyles$b = makeStyles()({
|
|
3721
3897
|
container: {
|
|
3722
3898
|
display: 'flex',
|
|
3723
3899
|
marginTop: 30,
|
|
@@ -3745,17 +3921,18 @@ const useStyles$b = makeStyles()({
|
|
|
3745
3921
|
},
|
|
3746
3922
|
});
|
|
3747
3923
|
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
React__default.
|
|
3755
|
-
|
|
3924
|
+
var isOverflowing = function (e) { return e.offsetWidth < e.scrollWidth; };
|
|
3925
|
+
var GrepCrumbs = function (_a) {
|
|
3926
|
+
var style = _a.style, onClick = _a.onClick, breadcrumbs = _a.breadcrumbs;
|
|
3927
|
+
var classes = useStyles$b().classes;
|
|
3928
|
+
var dispatch = useDispatch();
|
|
3929
|
+
var ref = React__default.useRef(null);
|
|
3930
|
+
var _b = __read(React__default.useState(false), 2), showTooltip = _b[0], setShowTooltip = _b[1];
|
|
3931
|
+
React__default.useEffect(function () {
|
|
3932
|
+
var current = ref.current;
|
|
3756
3933
|
setShowTooltip(!!current && isOverflowing(current));
|
|
3757
3934
|
}, [ref]);
|
|
3758
|
-
|
|
3935
|
+
var handleClick = function (crumb) {
|
|
3759
3936
|
if (onClick) {
|
|
3760
3937
|
onClick(crumb);
|
|
3761
3938
|
}
|
|
@@ -3763,13 +3940,15 @@ const GrepCrumbs = ({ style, onClick, breadcrumbs, }) => {
|
|
|
3763
3940
|
crumb.path && dispatch(push(crumb.path));
|
|
3764
3941
|
}
|
|
3765
3942
|
};
|
|
3766
|
-
return (React__default.createElement("div", { className: classes.container, style: style }, breadcrumbs.map((crumb, index)
|
|
3767
|
-
React__default.createElement(
|
|
3768
|
-
|
|
3769
|
-
|
|
3943
|
+
return (React__default.createElement("div", { className: classes.container, style: style }, breadcrumbs.map(function (crumb, index) {
|
|
3944
|
+
return crumb.path ? (React__default.createElement(Box, { key: index, display: "flex" },
|
|
3945
|
+
React__default.createElement(Link, { className: classes.link, tabIndex: 0, component: "button", onClick: function () { return handleClick(crumb); } }, crumb.label),
|
|
3946
|
+
index !== breadcrumbs.length - 1 && (React__default.createElement(Box, { margin: "auto 8px", height: "fit-content" /*lineHeight="20px"*/ }, ">")))) : (React__default.createElement(Tooltip, { key: index, title: showTooltip ? crumb.label : '' },
|
|
3947
|
+
React__default.createElement("div", { className: classes.current, ref: ref }, crumb.label)));
|
|
3948
|
+
})));
|
|
3770
3949
|
};
|
|
3771
3950
|
|
|
3772
|
-
|
|
3951
|
+
var useStyles$a = makeStyles()({
|
|
3773
3952
|
outer: {
|
|
3774
3953
|
alignItems: 'center',
|
|
3775
3954
|
background: Colors.white,
|
|
@@ -3790,27 +3969,27 @@ const useStyles$a = makeStyles()({
|
|
|
3790
3969
|
helptext: { margin: '0 10px 0 10px', color: '#6e6e6e', fontSize: 12 },
|
|
3791
3970
|
});
|
|
3792
3971
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
React.useEffect(()
|
|
3972
|
+
var SearchBar = function (props) {
|
|
3973
|
+
var inputRef = React.useRef(null);
|
|
3974
|
+
var _a = __read(React.useState(props.initValue || ''), 2), value = _a[0], setValue = _a[1];
|
|
3975
|
+
var classes = useStyles$a().classes;
|
|
3976
|
+
React.useEffect(function () {
|
|
3798
3977
|
if (props.autoFocus && inputRef.current) {
|
|
3799
3978
|
inputRef.current.focus();
|
|
3800
3979
|
}
|
|
3801
3980
|
});
|
|
3802
|
-
|
|
3803
|
-
|
|
3981
|
+
var _handleChange = function (event) {
|
|
3982
|
+
var newVal = event.target.value;
|
|
3804
3983
|
setValue(newVal);
|
|
3805
3984
|
props.onInputChange(newVal);
|
|
3806
3985
|
};
|
|
3807
|
-
|
|
3986
|
+
var _handleClear = function () {
|
|
3808
3987
|
setValue('');
|
|
3809
3988
|
props.onClear();
|
|
3810
3989
|
};
|
|
3811
3990
|
return (React.createElement(React.Fragment, null,
|
|
3812
3991
|
React.createElement(Box, { className: classes.outer, "data-testid": "searchBarContainer", style: {
|
|
3813
|
-
border: props.outlined ?
|
|
3992
|
+
border: props.outlined ? "1px solid ".concat(Colors.lightGrey) : 0,
|
|
3814
3993
|
} },
|
|
3815
3994
|
React.createElement(Box, { className: classes.icon },
|
|
3816
3995
|
React.createElement(Search, null)),
|
|
@@ -3827,42 +4006,53 @@ const SearchBar = (props) => {
|
|
|
3827
4006
|
props.searchAllText && props.onSearchAll && (React.createElement(Button, { color: "primary", onClick: props.onSearchAll }, props.searchAllText)))));
|
|
3828
4007
|
};
|
|
3829
4008
|
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
:
|
|
3838
|
-
|
|
3839
|
-
|
|
4009
|
+
var useStyles$9 = makeStyles()(function (theme, _a) {
|
|
4010
|
+
var elevation = _a.elevation;
|
|
4011
|
+
return ({
|
|
4012
|
+
cover: {
|
|
4013
|
+
background: theme.palette.grey.A200,
|
|
4014
|
+
marginBottom: 12,
|
|
4015
|
+
padding: '10px 0',
|
|
4016
|
+
boxShadow: elevation
|
|
4017
|
+
? "0px 3px 1px -2px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%), 0px 1px 5px 0px rgb(0 0 0 / 12%);"
|
|
4018
|
+
: 'none',
|
|
4019
|
+
},
|
|
4020
|
+
});
|
|
4021
|
+
});
|
|
3840
4022
|
|
|
3841
|
-
|
|
3842
|
-
|
|
4023
|
+
var GreyCover = function (_a) {
|
|
4024
|
+
var elevation = _a.elevation, children = _a.children;
|
|
4025
|
+
var classes = useStyles$9({ elevation: elevation }).classes;
|
|
3843
4026
|
return React.createElement(Box, { className: classes.cover }, children);
|
|
3844
4027
|
};
|
|
3845
4028
|
|
|
3846
|
-
|
|
3847
|
-
|
|
4029
|
+
var CircularLoading = function (_a) {
|
|
4030
|
+
var height = _a.height, props = __rest$1(_a, ["height"]);
|
|
4031
|
+
return (React.createElement(Box, { height: height, width: "100%", display: "flex", alignItems: "center", justifyContent: "center" },
|
|
4032
|
+
React.createElement(CircularProgress$1, __assign({}, props))));
|
|
4033
|
+
};
|
|
3848
4034
|
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
4035
|
+
var useStyles$8 = makeStyles()(function (theme) {
|
|
4036
|
+
var _a;
|
|
4037
|
+
return ({
|
|
4038
|
+
container: (_a = {
|
|
4039
|
+
width: '48%',
|
|
4040
|
+
display: 'flex',
|
|
4041
|
+
flexDirection: 'column'
|
|
4042
|
+
},
|
|
4043
|
+
_a[theme.breakpoints.down('lg')] = {
|
|
4044
|
+
width: '100%',
|
|
4045
|
+
},
|
|
4046
|
+
_a[theme.breakpoints.up('md')] = {
|
|
4047
|
+
width: '48%',
|
|
4048
|
+
},
|
|
4049
|
+
_a),
|
|
4050
|
+
});
|
|
4051
|
+
});
|
|
3862
4052
|
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
4053
|
+
var renderField$1 = function (id, label, value) { return (React.createElement(TextField, { id: id, disabled: true, label: label, value: value, variant: "outlined", style: { margin: '10px 0' }, InputProps: { style: { color: 'rgb(84, 84, 84)' } } })); };
|
|
4054
|
+
var ProfileInfo = function (props) {
|
|
4055
|
+
var classes = useStyles$8().classes;
|
|
3866
4056
|
return (React.createElement(Box, { className: classes.container },
|
|
3867
4057
|
renderField$1('firstname', 'Fornavn', props.firstName),
|
|
3868
4058
|
renderField$1('lastname', 'Etternavn', props.lastName),
|
|
@@ -3871,43 +4061,48 @@ const ProfileInfo = (props) => {
|
|
|
3871
4061
|
renderField$1('role', 'Rolle', props.role)));
|
|
3872
4062
|
};
|
|
3873
4063
|
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
4064
|
+
var useStyles$7 = makeStyles()(function (theme) {
|
|
4065
|
+
var _a;
|
|
4066
|
+
return ({
|
|
4067
|
+
container: (_a = {
|
|
4068
|
+
backgroundColor: 'rgb(241, 243, 244)',
|
|
4069
|
+
height: 'fit-content',
|
|
4070
|
+
display: 'flex',
|
|
4071
|
+
maxWidth: 500
|
|
4072
|
+
},
|
|
4073
|
+
_a[theme.breakpoints.down('lg')] = {
|
|
4074
|
+
maxWidth: 'unset',
|
|
4075
|
+
width: '100%',
|
|
4076
|
+
},
|
|
4077
|
+
_a[theme.breakpoints.up('md')] = {
|
|
4078
|
+
maxWidth: 500,
|
|
4079
|
+
},
|
|
4080
|
+
_a),
|
|
4081
|
+
content: {
|
|
4082
|
+
backgroundColor: 'unset',
|
|
4083
|
+
marginRight: 20,
|
|
3883
4084
|
},
|
|
3884
|
-
|
|
3885
|
-
|
|
4085
|
+
title: {
|
|
4086
|
+
backgroundColor: 'unset',
|
|
4087
|
+
fontSize: 16,
|
|
4088
|
+
margin: '20px 0',
|
|
3886
4089
|
},
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
title: {
|
|
3893
|
-
backgroundColor: 'unset',
|
|
3894
|
-
fontSize: 16,
|
|
3895
|
-
margin: '20px 0',
|
|
3896
|
-
},
|
|
3897
|
-
body: {
|
|
3898
|
-
backgroundColor: 'unset',
|
|
3899
|
-
h4: {
|
|
3900
|
-
marginRight: 20,
|
|
4090
|
+
body: {
|
|
4091
|
+
backgroundColor: 'unset',
|
|
4092
|
+
h4: {
|
|
4093
|
+
marginRight: 20,
|
|
4094
|
+
},
|
|
3901
4095
|
},
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
}
|
|
3907
|
-
})
|
|
4096
|
+
icon: {
|
|
4097
|
+
margin: '20px 10px',
|
|
4098
|
+
color: 'rgb(255, 158, 157)',
|
|
4099
|
+
},
|
|
4100
|
+
});
|
|
4101
|
+
});
|
|
3908
4102
|
|
|
3909
|
-
|
|
3910
|
-
|
|
4103
|
+
var GDPR = function (_a) {
|
|
4104
|
+
var children = _a.children;
|
|
4105
|
+
var classes = useStyles$7().classes;
|
|
3911
4106
|
return (React.createElement(Box, { className: classes.container },
|
|
3912
4107
|
React.createElement(Info, { className: classes.icon }),
|
|
3913
4108
|
React.createElement(Box, { className: classes.content },
|
|
@@ -3915,66 +4110,67 @@ const GDPR = ({ children }) => {
|
|
|
3915
4110
|
React.createElement(Typography, { className: classes.body }, children))));
|
|
3916
4111
|
};
|
|
3917
4112
|
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
4113
|
+
var GrepInput = function (_a) {
|
|
4114
|
+
var _b = _a.variant, variant = _b === void 0 ? 'standard' : _b, props = __rest$1(_a, ["variant"]);
|
|
4115
|
+
var errorMessage = props.errorMessage, helperText = props.helperText, shrink = props.shrink, value = props.value, rest = __rest$1(props, ["errorMessage", "helperText", "shrink", "value"]);
|
|
4116
|
+
var error = errorMessage ? errorMessage.length > 0 : false;
|
|
4117
|
+
return (React.createElement(TextField, __assign({}, rest, { variant: variant, helperText: errorMessage || helperText, value: value === null ? '' : value, InputLabelProps: { shrink: shrink }, error: error || rest.error })));
|
|
3922
4118
|
};
|
|
3923
4119
|
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
React.useEffect(()
|
|
4120
|
+
var GrepSelect = function (props) {
|
|
4121
|
+
var inputLabel = React.useRef(null);
|
|
4122
|
+
var _a = __read(React.useState(0), 2), labelWidth = _a[0], setLabelWidth = _a[1];
|
|
4123
|
+
React.useEffect(function () {
|
|
3928
4124
|
setLabelWidth(inputLabel.current.offsetWidth);
|
|
3929
4125
|
}, []);
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
4126
|
+
var _b = props.unselectOption, unselectOption = _b === void 0 ? true : _b, errorMessage = props.errorMessage, selectItems = props.selectItems, helperText = props.helperText, fullWidth = props.fullWidth, outlined = props.outlined, disabled = props.disabled, required = props.required, label = props.label, inputProps = props.inputProps, value = props.value, size = props.size, id = props.id, useCheckedSelect = props.useCheckedSelect, rest = __rest$1(props, ["unselectOption", "errorMessage", "selectItems", "helperText", "fullWidth", "outlined", "disabled", "required", "label", "inputProps", "value", "size", "id", "useCheckedSelect"]);
|
|
4127
|
+
var error = errorMessage ? errorMessage.length > 0 : false;
|
|
4128
|
+
var selected = value;
|
|
3933
4129
|
return (React.createElement(FormControl, { variant: outlined ? 'outlined' : 'standard', className: props.className, fullWidth: fullWidth, required: required, style: props.style, error: error, size: size, disabled: disabled },
|
|
3934
4130
|
React.createElement(InputLabel, { htmlFor: id, ref: inputLabel, style: {
|
|
3935
4131
|
minWidth: 'max-content',
|
|
3936
4132
|
overflow: 'visible',
|
|
3937
4133
|
} }, label),
|
|
3938
|
-
React.createElement(Select, {
|
|
4134
|
+
React.createElement(Select, __assign({}, rest, { inputProps: __assign({ id: id }, inputProps), disabled: !selectItems || disabled, value: value === null ? '' : value, style: { minWidth: labelWidth + (outlined ? 35 : 25) },
|
|
3939
4135
|
// @todo: make input respect label length
|
|
3940
|
-
input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: {
|
|
3941
|
-
...rest.MenuProps,
|
|
3942
|
-
anchorOrigin: {
|
|
4136
|
+
input: outlined ? React.createElement(OutlinedInput, { label: label }) : React.createElement(Input, null), MenuProps: __assign(__assign({}, rest.MenuProps), { anchorOrigin: {
|
|
3943
4137
|
vertical: 'bottom',
|
|
3944
4138
|
horizontal: 'center',
|
|
3945
|
-
},
|
|
3946
|
-
transformOrigin: {
|
|
4139
|
+
}, transformOrigin: {
|
|
3947
4140
|
vertical: 'top',
|
|
3948
4141
|
horizontal: 'center',
|
|
3949
|
-
},
|
|
3950
|
-
} },
|
|
4142
|
+
} }) }),
|
|
3951
4143
|
unselectOption && (React.createElement(MenuItem, { value: "" },
|
|
3952
4144
|
React.createElement("em", null, "Fjern valgt"))),
|
|
3953
|
-
selectItems.map((
|
|
3954
|
-
|
|
3955
|
-
React.createElement(
|
|
4145
|
+
selectItems.map(function (_a, i) {
|
|
4146
|
+
var label = _a.label, value = _a.value, disabled = _a.disabled, lang = _a.lang;
|
|
4147
|
+
return (React.createElement(MenuItem, { key: i, value: value, disabled: disabled, lang: lang },
|
|
4148
|
+
useCheckedSelect && (React.createElement(Checkbox, { checked: (selected === null || selected === void 0 ? void 0 : selected.indexOf(value)) > -1 })),
|
|
4149
|
+
React.createElement(ListItemText, { sx: { margin: '0px', span: { lineHeight: '1.4375em' } }, primary: label ? label : value })));
|
|
4150
|
+
})),
|
|
3956
4151
|
React.createElement(FormHelperText, null, errorMessage || helperText)));
|
|
3957
4152
|
};
|
|
3958
4153
|
|
|
3959
|
-
|
|
4154
|
+
var defaultOptions$2 = {
|
|
3960
4155
|
utc: true,
|
|
3961
4156
|
preserveTime: false,
|
|
3962
4157
|
};
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
4158
|
+
var useDate = function (value, options) {
|
|
4159
|
+
if (value === void 0) { value = null; }
|
|
4160
|
+
var _a = __assign(__assign({}, options), defaultOptions$2), utc = _a.utc, preserveTime = _a.preserveTime;
|
|
4161
|
+
var _b = __read(useState(null), 2), date = _b[0], _setDate = _b[1];
|
|
4162
|
+
var getDate = useCallback$1(function (value) {
|
|
3967
4163
|
if (value) {
|
|
3968
|
-
|
|
3969
|
-
return preserveTime ?
|
|
4164
|
+
var date_1 = dayjs(value);
|
|
4165
|
+
return preserveTime ? date_1 : date_1.startOf('day');
|
|
3970
4166
|
}
|
|
3971
4167
|
return null;
|
|
3972
4168
|
}, [preserveTime]);
|
|
3973
|
-
|
|
3974
|
-
|
|
4169
|
+
var setDate = function (next) {
|
|
4170
|
+
var nextDate = getDate(next);
|
|
3975
4171
|
hasDateChanged(date, nextDate) && _setDate(nextDate);
|
|
3976
4172
|
};
|
|
3977
|
-
useMemo$1(()
|
|
4173
|
+
useMemo$1(function () { return setDate(value ? parseDate(value, { utc: utc }) : null); }, [
|
|
3978
4174
|
value,
|
|
3979
4175
|
utc,
|
|
3980
4176
|
]);
|
|
@@ -4373,58 +4569,55 @@ var lodash_debounce = debounce$1;
|
|
|
4373
4569
|
* return (<><input {...{ref,onChange}}/><p>{txt}</p></>)
|
|
4374
4570
|
* }
|
|
4375
4571
|
*/
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4572
|
+
var useDebounce = function (func, opt, deps) {
|
|
4573
|
+
var debounce = useMemo$1(function () {
|
|
4574
|
+
var wait = opt.wait, settings = __rest$1(opt, ["wait"]);
|
|
4379
4575
|
return lodash_debounce(func, wait, settings);
|
|
4380
4576
|
}, deps || []);
|
|
4381
|
-
useEffect(()
|
|
4577
|
+
useEffect(function () { return debounce.cancel; }, [debounce]);
|
|
4382
4578
|
return debounce;
|
|
4383
4579
|
};
|
|
4384
4580
|
|
|
4385
|
-
|
|
4386
|
-
return match ? elements.filter((el)
|
|
4387
|
-
};
|
|
4388
|
-
|
|
4389
|
-
identify: (el)
|
|
4581
|
+
var filterElements = function (match) { return function (elements) {
|
|
4582
|
+
return match ? elements.filter(function (el) { return el.nodeName.match(match); }) : elements;
|
|
4583
|
+
}; };
|
|
4584
|
+
var defaultOptions$1 = {
|
|
4585
|
+
identify: function (el) { return el.id; },
|
|
4390
4586
|
config: {
|
|
4391
4587
|
attributes: false,
|
|
4392
4588
|
childList: true,
|
|
4393
4589
|
subtree: true,
|
|
4394
4590
|
},
|
|
4395
4591
|
};
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
const elements = filter ? all.filter(filter) : all;
|
|
4405
|
-
return elements.reduce((curr, el) => {
|
|
4406
|
-
const id = identify(el);
|
|
4592
|
+
var useContentElements = function (container, selector, options) {
|
|
4593
|
+
var _a = __assign(__assign({}, defaultOptions$1), options), filter = _a.filter, config = _a.config, identify = _a.identify;
|
|
4594
|
+
var _b = __read(useState({}), 2), elements = _b[0], setElements = _b[1];
|
|
4595
|
+
var getElements = useCallback$1(function () {
|
|
4596
|
+
var all = Array.from(container.querySelectorAll(selector));
|
|
4597
|
+
var elements = filter ? all.filter(filter) : all;
|
|
4598
|
+
return elements.reduce(function (curr, el) {
|
|
4599
|
+
var id = identify(el);
|
|
4407
4600
|
if (curr[id])
|
|
4408
4601
|
throw Error('duplicate identifiers!');
|
|
4409
4602
|
curr[id] = el;
|
|
4410
4603
|
return curr;
|
|
4411
4604
|
}, {});
|
|
4412
4605
|
}, [container, selector, identify, filter]);
|
|
4413
|
-
useEffect(()
|
|
4606
|
+
useEffect(function () {
|
|
4414
4607
|
// early exit, nothing to observe
|
|
4415
4608
|
if (!container)
|
|
4416
4609
|
return;
|
|
4417
4610
|
// set current elements
|
|
4418
4611
|
setElements(getElements());
|
|
4419
4612
|
// Observe changes in DOM
|
|
4420
|
-
|
|
4613
|
+
var observer = new MutationObserver(function () {
|
|
4421
4614
|
setElements(getElements());
|
|
4422
4615
|
});
|
|
4423
4616
|
// start observing
|
|
4424
4617
|
observer.observe(container, config);
|
|
4425
4618
|
console.debug('observing container', container);
|
|
4426
4619
|
// stop observing when unmounted
|
|
4427
|
-
return ()
|
|
4620
|
+
return function () {
|
|
4428
4621
|
observer.disconnect();
|
|
4429
4622
|
console.debug('observing disconnected', container);
|
|
4430
4623
|
};
|
|
@@ -4432,98 +4625,100 @@ const useContentElements = (container, selector, options) => {
|
|
|
4432
4625
|
return elements;
|
|
4433
4626
|
};
|
|
4434
4627
|
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4628
|
+
var DatePicker = function (_a) {
|
|
4629
|
+
var id = _a.id, label = _a.label, value = _a.value, variant = _a.variant, onChange = _a.onChange, errorMessage = _a.errorMessage, placeholder = _a.placeholder, fullWidth = _a.fullWidth, required = _a.required, onFocus = _a.onFocus, margin = _a.margin, sx = _a.sx, props = __rest$1(_a, ["id", "label", "value", "variant", "onChange", "errorMessage", "placeholder", "fullWidth", "required", "onFocus", "margin", "sx"]);
|
|
4630
|
+
var _b = __read(useDate(value), 2), date = _b[0], setDate = _b[1];
|
|
4631
|
+
var _c = __read(useState(), 2), error = _c[0], setError = _c[1];
|
|
4632
|
+
var helperText = errorMessage || error || props.helperText;
|
|
4633
|
+
useEffect(function () { return onChange(date); }, [String(date)]);
|
|
4440
4634
|
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: 'nb' },
|
|
4441
4635
|
React__default.createElement(DesktopDatePicker
|
|
4442
4636
|
// clearable @todo
|
|
4443
|
-
, {
|
|
4637
|
+
, __assign({
|
|
4444
4638
|
// clearable @todo
|
|
4445
|
-
inputFormat: "DD/MM/YYYY", onError: (reason)
|
|
4639
|
+
inputFormat: "DD/MM/YYYY", onError: function (reason) {
|
|
4446
4640
|
switch (reason) {
|
|
4447
4641
|
case 'invalidDate':
|
|
4448
4642
|
setError('Ugyldig dato');
|
|
4449
4643
|
break;
|
|
4450
4644
|
case 'maxDate':
|
|
4451
|
-
setError(
|
|
4645
|
+
setError("Dato m\u00E5 v\u00E6re f\u00F8r ".concat(dayjs(props.maxDate)
|
|
4452
4646
|
.add(1, 'day')
|
|
4453
|
-
.format('DD/MM/YYYY')
|
|
4647
|
+
.format('DD/MM/YYYY')));
|
|
4454
4648
|
break;
|
|
4455
4649
|
case 'minDate':
|
|
4456
|
-
setError(
|
|
4650
|
+
setError("Dato m\u00E5 v\u00E6re etter ".concat(dayjs(props.minDate)
|
|
4457
4651
|
.subtract(1, 'day')
|
|
4458
|
-
.format('DD/MM/YYYY')
|
|
4652
|
+
.format('DD/MM/YYYY')));
|
|
4459
4653
|
break;
|
|
4460
4654
|
default:
|
|
4461
4655
|
setError(undefined);
|
|
4462
4656
|
}
|
|
4463
|
-
}, value: date, onChange: setDate, renderInput: (params)
|
|
4657
|
+
}, value: date, onChange: setDate, renderInput: function (params) { return (React__default.createElement(TextField, __assign({ id: id }, params, { label: label, variant: variant, onFocus: onFocus, required: required, fullWidth: fullWidth, placeholder: placeholder, sx: sx, margin: margin, error: !!error || !!errorMessage }, (helperText && { helperText: helperText })))); } }, props))));
|
|
4464
4658
|
};
|
|
4465
4659
|
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4660
|
+
var GrepDateRange = function (_a) {
|
|
4661
|
+
var onChange = _a.onChange, _b = _a.spacing, spacing = _b === void 0 ? 3 : _b, style = _a.style, fullWidth = _a.fullWidth, fromProperties = _a.from, toProperties = _a.to, properties = __rest$1(_a, ["onChange", "spacing", "style", "fullWidth", "from", "to"]);
|
|
4662
|
+
var _c = __read(useDate(fromProperties.value), 2), from = _c[0], setFrom = _c[1];
|
|
4663
|
+
var _d = __read(useDate(toProperties.value), 2), to = _d[0], setTo = _d[1];
|
|
4664
|
+
var minDate = properties.minDate, maxDate = properties.maxDate, commonProperties = __rest$1(properties, ["minDate", "maxDate"]);
|
|
4665
|
+
useEffect(function () { return onChange(new DateRangeValue(from, to)); }, [String(from), String(to)]);
|
|
4471
4666
|
return (React__default.createElement(Grid, { container: true, spacing: spacing, style: style },
|
|
4472
4667
|
React__default.createElement(Grid, { item: true, xs: 12, sm: fullWidth ? 12 : 6 },
|
|
4473
|
-
React__default.createElement(DatePicker, { id: String(fromProperties.label), fullWidth: true, minDate: minDate,
|
|
4668
|
+
React__default.createElement(DatePicker, __assign({ id: String(fromProperties.label), fullWidth: true, minDate: minDate }, commonProperties, fromProperties, { value: from, maxDate: (to === null || to === void 0 ? void 0 : to.subtract(1, 'day')) || undefined, onChange: setFrom }))),
|
|
4474
4669
|
React__default.createElement(Grid, { item: true, xs: 12, sm: fullWidth ? 12 : 6 },
|
|
4475
|
-
React__default.createElement(DatePicker, { id: String(toProperties.label), fullWidth: true, maxDate: maxDate,
|
|
4670
|
+
React__default.createElement(DatePicker, __assign({ id: String(toProperties.label), fullWidth: true, maxDate: maxDate }, commonProperties, toProperties, { value: to, minDate: (from === null || from === void 0 ? void 0 : from.add(1, 'day')) || undefined, onChange: setTo })))));
|
|
4476
4671
|
};
|
|
4477
4672
|
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4673
|
+
var renderField = function (_a) {
|
|
4674
|
+
var key = _a.key, value = _a.value;
|
|
4675
|
+
return (React.createElement(Box, { key: key, display: "flex", marginRight: "20px" },
|
|
4676
|
+
React.createElement(Typography, { variant: "body1", style: { color: Colors.grey, marginRight: '2rem' } },
|
|
4677
|
+
key,
|
|
4678
|
+
":"),
|
|
4679
|
+
React.createElement(Typography, { variant: "body1" }, value)));
|
|
4680
|
+
};
|
|
4681
|
+
var renderHorizontal = function (infoFields) { return (React.createElement(Box, { display: "flex", flexWrap: "wrap", justifyContent: "space-between" }, infoFields.map(renderField))); };
|
|
4682
|
+
var renderVertical = function (infoFields) {
|
|
4683
|
+
return infoFields.map(renderField);
|
|
4684
|
+
};
|
|
4685
|
+
var InfoContainer = function (props) { return (React.createElement(Box, { style: __assign({ paddingTop: 20 }, props.style) },
|
|
4486
4686
|
props.header && (React.createElement(Typography, { variant: "h6", style: { paddingBottom: 10 } }, props.header)),
|
|
4487
4687
|
props.inline
|
|
4488
4688
|
? renderHorizontal(props.infoFields)
|
|
4489
|
-
: renderVertical(props.infoFields)));
|
|
4689
|
+
: renderVertical(props.infoFields))); };
|
|
4490
4690
|
|
|
4491
|
-
|
|
4691
|
+
var textStyles = {
|
|
4492
4692
|
userSelect: 'none',
|
|
4493
4693
|
whiteSpace: 'nowrap',
|
|
4494
4694
|
outline: 'none',
|
|
4495
4695
|
fontSize: 16,
|
|
4496
4696
|
};
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
fontWeight: 400,
|
|
4502
|
-
};
|
|
4697
|
+
var useStyles$6 = makeStyles()(function (_a, _props, classes) {
|
|
4698
|
+
var _b;
|
|
4699
|
+
var palette = _a.palette;
|
|
4700
|
+
var text = __assign(__assign({}, textStyles), { color: 'inherit', fontWeight: 400 });
|
|
4503
4701
|
return {
|
|
4504
4702
|
container: {
|
|
4505
4703
|
padding: 10,
|
|
4506
4704
|
display: 'flex',
|
|
4507
4705
|
flexDirection: 'column',
|
|
4508
4706
|
},
|
|
4509
|
-
item: {
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4707
|
+
item: (_b = {
|
|
4708
|
+
cursor: 'pointer',
|
|
4709
|
+
color: palette.text.disabled,
|
|
4710
|
+
outline: 'none',
|
|
4711
|
+
'&:hover': {
|
|
4712
|
+
color: palette.primary.main,
|
|
4713
|
+
}
|
|
4515
4714
|
},
|
|
4516
|
-
[
|
|
4715
|
+
_b["&:focus .".concat(classes.text)] = {
|
|
4517
4716
|
color: palette.primary.main,
|
|
4518
4717
|
outline: 'auto',
|
|
4519
4718
|
},
|
|
4520
|
-
|
|
4521
|
-
text,
|
|
4522
|
-
selected: {
|
|
4523
|
-
...textStyles,
|
|
4524
|
-
color: palette.primary.main,
|
|
4525
|
-
fontWeight: 500,
|
|
4526
|
-
},
|
|
4719
|
+
_b),
|
|
4720
|
+
text: text,
|
|
4721
|
+
selected: __assign(__assign({}, textStyles), { color: palette.primary.main, fontWeight: 500 }),
|
|
4527
4722
|
icon: {
|
|
4528
4723
|
minWidth: 'fit-content',
|
|
4529
4724
|
marginRight: 2,
|
|
@@ -4531,39 +4726,44 @@ const useStyles$6 = makeStyles()(({ palette }, _props, classes) => {
|
|
|
4531
4726
|
};
|
|
4532
4727
|
});
|
|
4533
4728
|
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4729
|
+
var Sidebar = function (_a) {
|
|
4730
|
+
var pages = _a.pages, onPageClick = _a.onPageClick, currentPageId = _a.currentPageId;
|
|
4731
|
+
var _b = __read(React.useState([]), 2), expanded = _b[0], setExpanded = _b[1];
|
|
4732
|
+
var classes = useStyles$6().classes;
|
|
4733
|
+
React.useEffect(function () {
|
|
4734
|
+
var _a;
|
|
4538
4735
|
if (currentPageId) {
|
|
4539
|
-
|
|
4540
|
-
!!pageId && setExpanded([
|
|
4736
|
+
var pageId = (_a = pages.find(function (p) { var _a; return (_a = p.children) === null || _a === void 0 ? void 0 : _a.some(function (c) { return c.id === currentPageId; }); })) === null || _a === void 0 ? void 0 : _a.id;
|
|
4737
|
+
!!pageId && setExpanded(__spreadArray(__spreadArray([], __read(expanded), false), [pageId], false));
|
|
4541
4738
|
}
|
|
4542
4739
|
}, [pages]);
|
|
4543
|
-
|
|
4740
|
+
var toggleExpand = function (id) {
|
|
4544
4741
|
if (expanded.includes(id)) {
|
|
4545
|
-
setExpanded([
|
|
4742
|
+
setExpanded(__spreadArray([], __read(expanded.filter(function (_id) { return _id !== id; })), false));
|
|
4546
4743
|
}
|
|
4547
4744
|
else {
|
|
4548
|
-
setExpanded([
|
|
4745
|
+
setExpanded(__spreadArray(__spreadArray([], __read(expanded), false), [id], false));
|
|
4549
4746
|
}
|
|
4550
4747
|
};
|
|
4551
|
-
|
|
4748
|
+
var handleClick = function (page) {
|
|
4552
4749
|
page.children ? toggleExpand(page.id) : onPageClick(page);
|
|
4553
4750
|
};
|
|
4554
|
-
|
|
4751
|
+
var renderItem = function (page) { return (React.createElement(React.Fragment, null,
|
|
4555
4752
|
page.linkIcon && (React.createElement(ListItemIcon, { className: classes.icon }, page.linkIcon)),
|
|
4556
|
-
React.createElement(ListItemText$1, { sx: { outline: 'none !important' }, tabIndex: -1, disableTypography: true, primary: page.label, className: page.id === currentPageId ? classes.selected : classes.text })));
|
|
4753
|
+
React.createElement(ListItemText$1, { sx: { outline: 'none !important' }, tabIndex: -1, disableTypography: true, primary: page.label, className: page.id === currentPageId ? classes.selected : classes.text }))); };
|
|
4557
4754
|
return (React.createElement(Box$1, { className: classes.container },
|
|
4558
|
-
React.createElement(List$1, null, pages.map((page)
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4755
|
+
React.createElement(List$1, null, pages.map(function (page) {
|
|
4756
|
+
var _a;
|
|
4757
|
+
return (React.createElement("div", { key: page.id },
|
|
4758
|
+
React.createElement(ListItem$1, { key: page.id, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(page); }, onKeyPress: keyboard.onActivation(function () { return handleClick(page); }) },
|
|
4759
|
+
renderItem(page),
|
|
4760
|
+
page.children ? (expanded.includes(page.id) ? (React.createElement(ExpandMore, null)) : (React.createElement(ExpandLess, null))) : null),
|
|
4761
|
+
React.createElement(Collapse, { in: expanded.includes(page.id), timeout: "auto", unmountOnExit: true },
|
|
4762
|
+
React.createElement(List$1, { disablePadding: true }, (_a = page.children) === null || _a === void 0 ? void 0 : _a.map(function (child) { return (React.createElement(ListItem$1, { key: child.id, style: { paddingLeft: '30px' }, tabIndex: 0, className: classes.item, onClick: function () { return handleClick(child); }, onKeyPress: keyboard.onActivation(function () { return handleClick(child); }) }, renderItem(child))); })))));
|
|
4763
|
+
}))));
|
|
4564
4764
|
};
|
|
4565
4765
|
|
|
4566
|
-
var useStyles$5 = makeStyles()(()
|
|
4766
|
+
var useStyles$5 = makeStyles()(function () { return ({
|
|
4567
4767
|
message: {
|
|
4568
4768
|
overflowWrap: 'break-word',
|
|
4569
4769
|
backgroundColor: '#f8e9d6',
|
|
@@ -4600,16 +4800,17 @@ var useStyles$5 = makeStyles()(() => ({
|
|
|
4600
4800
|
alignSelf: 'center',
|
|
4601
4801
|
marginLeft: 5,
|
|
4602
4802
|
},
|
|
4603
|
-
}));
|
|
4803
|
+
}); });
|
|
4604
4804
|
|
|
4605
|
-
|
|
4606
|
-
|
|
4805
|
+
var ServiceMessage = function (_a) {
|
|
4806
|
+
var id = _a.id, message = _a.message, isPublic = _a.isPublic, onDismiss = _a.onDismiss;
|
|
4807
|
+
var classes = useStyles$5().classes;
|
|
4607
4808
|
return (React.createElement(Box, { className: classes.message },
|
|
4608
4809
|
React.createElement(Typography, { className: classes.messageType },
|
|
4609
4810
|
React.createElement(Warning, { className: classes.warning }),
|
|
4610
4811
|
"Driftsmelding"),
|
|
4611
4812
|
React.createElement(Typography, { className: classes.messageText }, message),
|
|
4612
|
-
!isPublic && onDismiss && (React.createElement(IconButton, { className: classes.button, onClick: ()
|
|
4813
|
+
!isPublic && onDismiss && (React.createElement(IconButton, { className: classes.button, onClick: function () { return onDismiss(id); }, size: "large" },
|
|
4613
4814
|
React.createElement(Close, { className: classes.close })))));
|
|
4614
4815
|
};
|
|
4615
4816
|
|
|
@@ -13406,110 +13607,128 @@ var ConnectedDroppable = connect(makeMapStateToProps$1, mapDispatchToProps$1, nu
|
|
|
13406
13607
|
})(Droppable);
|
|
13407
13608
|
ConnectedDroppable.defaultProps = defaultProps;
|
|
13408
13609
|
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
el.style.width =
|
|
13412
|
-
el.style.height =
|
|
13610
|
+
var setDimensions = function (el) {
|
|
13611
|
+
var _a = el.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
13612
|
+
el.style.width = "".concat(width, "px");
|
|
13613
|
+
el.style.height = "".concat(height, "px");
|
|
13413
13614
|
};
|
|
13414
|
-
|
|
13615
|
+
var clearDimensions = function (el) {
|
|
13415
13616
|
el.style.removeProperty('height');
|
|
13416
13617
|
el.style.removeProperty('width');
|
|
13417
13618
|
};
|
|
13418
|
-
function SortableTableCell(
|
|
13419
|
-
|
|
13420
|
-
|
|
13619
|
+
function SortableTableCell(_a) {
|
|
13620
|
+
var locked = _a.locked, children = _a.children, props = __rest$1(_a, ["locked", "children"]);
|
|
13621
|
+
var ref = useRef();
|
|
13622
|
+
useMemo$1(function () {
|
|
13421
13623
|
if (ref.current) {
|
|
13422
13624
|
locked ? setDimensions(ref.current) : clearDimensions(ref.current);
|
|
13423
13625
|
}
|
|
13424
13626
|
}, [locked]);
|
|
13425
|
-
return (React__default.createElement(TableCell$1, { ref: ref,
|
|
13627
|
+
return (React__default.createElement(TableCell$1, __assign({ ref: ref }, props), children));
|
|
13426
13628
|
}
|
|
13427
13629
|
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13630
|
+
var useStyles$4 = makeStyles()(function (_a, _b) {
|
|
13631
|
+
var palette = _a.palette, transitions = _a.transitions;
|
|
13632
|
+
var isDragging = _b.isDragging;
|
|
13633
|
+
return ({
|
|
13634
|
+
row: {
|
|
13635
|
+
transition: transitions.create(['background-color'], {
|
|
13636
|
+
duration: transitions.duration.shorter,
|
|
13637
|
+
easing: transitions.easing.easeOut,
|
|
13638
|
+
}),
|
|
13639
|
+
backgroundColor: isDragging
|
|
13640
|
+
? "var(--tablecell__background--drag, ".concat(hex2rgba(palette.primary.main, 0.25), ")")
|
|
13641
|
+
: 'var(--tablecell__background)',
|
|
13642
|
+
},
|
|
13643
|
+
});
|
|
13644
|
+
});
|
|
13645
|
+
|
|
13646
|
+
function SortableTableRow(_a) {
|
|
13647
|
+
var item = _a.item, id = _a.id, index = _a.index, render = _a.render, disabled = _a.disabled;
|
|
13648
|
+
var cells = useMemo$1(function () { return render(item); }, [item, render]);
|
|
13649
|
+
var renderRow = useCallback$1(function (isDragging) {
|
|
13650
|
+
return cells.map(function (_a, index) {
|
|
13651
|
+
var value = _a.value, properties = _a.properties;
|
|
13652
|
+
return (React__default.createElement(SortableTableCell, __assign({ key: "dragable-".concat(id, "-").concat(index), locked: isDragging }, properties), value));
|
|
13653
|
+
});
|
|
13654
|
+
}, [cells, id]);
|
|
13655
|
+
return (React__default.createElement(PublicDraggable, { draggableId: "dragable-".concat(id), index: index, isDragDisabled: disabled }, function (provided, _a) {
|
|
13656
|
+
var isDragging = _a.isDragging;
|
|
13657
|
+
var classes = useStyles$4({ isDragging: isDragging }).classes;
|
|
13658
|
+
return (React__default.createElement(TableRow$1, __assign({ className: classes.row, ref: provided.innerRef }, provided.draggableProps),
|
|
13659
|
+
React__default.createElement(TableCell$1, __assign({ style: { width: '45px', padding: '5px 10px' } }, provided.dragHandleProps),
|
|
13447
13660
|
React__default.createElement(DragIndicator, null)),
|
|
13448
13661
|
renderRow(isDragging)));
|
|
13449
13662
|
}));
|
|
13450
13663
|
}
|
|
13451
13664
|
|
|
13452
13665
|
function reorder(list, startIndex, endIndex) {
|
|
13453
|
-
|
|
13666
|
+
var _a = __read(list.splice(startIndex, 1), 1), removed = _a[0];
|
|
13454
13667
|
list.splice(endIndex, 0, removed);
|
|
13455
13668
|
return list;
|
|
13456
13669
|
}
|
|
13457
13670
|
function castCellNode(value) {
|
|
13458
13671
|
return typeof value === 'object' && value.value !== undefined
|
|
13459
13672
|
? value
|
|
13460
|
-
: { value };
|
|
13673
|
+
: { value: value };
|
|
13461
13674
|
}
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13675
|
+
var SortableTable = function (_a) {
|
|
13676
|
+
var columns = _a.columns, items = _a.items, identify = _a.identify, headerValue = _a.headerValue, cellValue = _a.cellValue, disabled = _a.disabled, onChange = _a.onChange;
|
|
13677
|
+
var _b = __read(useState(items), 2), records = _b[0], setRecords = _b[1];
|
|
13678
|
+
var _c = __read(useState(false), 2), isDragging = _c[0], setIsDragging = _c[1];
|
|
13679
|
+
useMemo$1(function () {
|
|
13466
13680
|
return setRecords(items);
|
|
13467
13681
|
}, [items]);
|
|
13468
|
-
|
|
13682
|
+
var onDragStart = function () {
|
|
13469
13683
|
setIsDragging(true);
|
|
13470
13684
|
};
|
|
13471
|
-
|
|
13685
|
+
var onDragEnd = function (result) {
|
|
13472
13686
|
setIsDragging(false);
|
|
13473
13687
|
if (result.destination) {
|
|
13474
|
-
|
|
13688
|
+
var newOrder = reorder(records, result.source.index, result.destination.index);
|
|
13475
13689
|
setRecords(newOrder);
|
|
13476
13690
|
onChange &&
|
|
13477
|
-
onChange(newOrder.map((record, index)
|
|
13691
|
+
onChange(newOrder.map(function (record, index) { return ({
|
|
13478
13692
|
id: identify(record),
|
|
13479
|
-
index,
|
|
13480
|
-
})));
|
|
13693
|
+
index: index,
|
|
13694
|
+
}); }));
|
|
13481
13695
|
}
|
|
13482
13696
|
};
|
|
13483
|
-
|
|
13484
|
-
return columns.map(
|
|
13697
|
+
var headers = useMemo$1(function () {
|
|
13698
|
+
return columns.map(function (column) {
|
|
13699
|
+
return castCellNode(headerValue ? headerValue(column) : column);
|
|
13700
|
+
});
|
|
13485
13701
|
}, [columns, headerValue]);
|
|
13486
|
-
|
|
13702
|
+
var getCellValue = useCallback$1(function (column, item) {
|
|
13487
13703
|
return castCellNode(cellValue ? cellValue(column, item) : item[column]);
|
|
13488
13704
|
}, [cellValue]);
|
|
13489
|
-
|
|
13705
|
+
var render = useCallback$1(function (item) {
|
|
13706
|
+
return columns.map(function (column) { return getCellValue(column, item); });
|
|
13707
|
+
}, [columns, getCellValue]);
|
|
13490
13708
|
return (React__default.createElement(Table$1, null,
|
|
13491
13709
|
React__default.createElement(TableHead, null,
|
|
13492
13710
|
React__default.createElement(TableRow, null,
|
|
13493
13711
|
React__default.createElement(SortableTableCell, { locked: isDragging }),
|
|
13494
|
-
headers.map((
|
|
13495
|
-
|
|
13712
|
+
headers.map(function (_a, index) {
|
|
13713
|
+
var value = _a.value, properties = _a.properties;
|
|
13714
|
+
return (React__default.createElement(SortableTableCell, __assign({ key: "header-".concat(index), locked: isDragging }, properties), value));
|
|
13496
13715
|
}))),
|
|
13497
13716
|
React__default.createElement(DragDropContext, { onDragEnd: onDragEnd, onBeforeDragStart: onDragStart },
|
|
13498
|
-
React__default.createElement(ConnectedDroppable, { droppableId: "droppable", direction: "vertical" }, (provided)
|
|
13499
|
-
records.map((item, index)
|
|
13500
|
-
|
|
13717
|
+
React__default.createElement(ConnectedDroppable, { droppableId: "droppable", direction: "vertical" }, function (provided) { return (React__default.createElement(TableBody$1, __assign({ ref: provided.innerRef }, provided.droppableProps),
|
|
13718
|
+
records.map(function (item, index) {
|
|
13719
|
+
var props = {
|
|
13501
13720
|
id: identify(item),
|
|
13502
|
-
item,
|
|
13503
|
-
index,
|
|
13504
|
-
render,
|
|
13505
|
-
disabled,
|
|
13721
|
+
item: item,
|
|
13722
|
+
index: index,
|
|
13723
|
+
render: render,
|
|
13724
|
+
disabled: disabled,
|
|
13506
13725
|
};
|
|
13507
|
-
return (React__default.createElement(SortableTableRow, { key:
|
|
13726
|
+
return (React__default.createElement(SortableTableRow, __assign({ key: "item-".concat(props.id) }, props)));
|
|
13508
13727
|
}),
|
|
13509
|
-
provided.placeholder))))));
|
|
13728
|
+
provided.placeholder)); }))));
|
|
13510
13729
|
};
|
|
13511
13730
|
|
|
13512
|
-
|
|
13731
|
+
var EditorContext = createContext({});
|
|
13513
13732
|
|
|
13514
13733
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
|
13515
13734
|
|
|
@@ -20174,52 +20393,58 @@ function stateFromHTML(html, options) {
|
|
|
20174
20393
|
return stateFromElement(element, otherOptions);
|
|
20175
20394
|
}
|
|
20176
20395
|
|
|
20177
|
-
|
|
20178
|
-
|
|
20396
|
+
var createState = function (content, decorators) {
|
|
20397
|
+
var decorator = decorators ? new CompositeDecorator(decorators) : undefined;
|
|
20179
20398
|
if (content) {
|
|
20180
|
-
|
|
20399
|
+
var state = stateFromHTML(content);
|
|
20181
20400
|
return EditorState.createWithContent(state, decorator);
|
|
20182
20401
|
}
|
|
20183
20402
|
return EditorState.createEmpty(decorator);
|
|
20184
20403
|
};
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
|
|
20188
|
-
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
}
|
|
20192
|
-
|
|
20404
|
+
var convert2html = function (content, options) {
|
|
20405
|
+
if (options === void 0) { options = {
|
|
20406
|
+
inlineStyles: {
|
|
20407
|
+
BOLD: { element: 'strong' },
|
|
20408
|
+
ITALIC: { element: 'i' },
|
|
20409
|
+
UNSTYLED: { element: 'p' },
|
|
20410
|
+
},
|
|
20411
|
+
}; }
|
|
20412
|
+
var html = content.getPlainText().trim().length
|
|
20193
20413
|
? stateToHTML(content, options)
|
|
20194
20414
|
: '';
|
|
20195
20415
|
return html; //.replace(/ /, ' ');
|
|
20196
20416
|
};
|
|
20197
|
-
|
|
20198
|
-
|
|
20417
|
+
var convert2txt = function (content) {
|
|
20418
|
+
return content.getPlainText();
|
|
20419
|
+
};
|
|
20420
|
+
var parseContentState = function (state) { return ({
|
|
20199
20421
|
txt: convert2txt(state).trim(),
|
|
20200
20422
|
html: convert2html(state),
|
|
20201
|
-
});
|
|
20202
|
-
|
|
20203
|
-
|
|
20423
|
+
}); };
|
|
20424
|
+
var parseContent = function (content, decorators) {
|
|
20425
|
+
return parseContentState(createState(content, decorators).getCurrentContent());
|
|
20426
|
+
};
|
|
20427
|
+
var UpdateStyle = function (state, style) { return RichUtils.toggleInlineStyle(state, style); };
|
|
20204
20428
|
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20429
|
+
var Provider = function (_a) {
|
|
20430
|
+
var html = _a.html, decorators = _a.decorators, children = _a.children;
|
|
20431
|
+
var _b = __read(useState(createState('', decorators)), 2), state = _b[0], setState = _b[1];
|
|
20432
|
+
var _c = __read(useState(), 2), selection = _c[0], setSelection = _c[1];
|
|
20433
|
+
useMemo$1(function () {
|
|
20209
20434
|
console.debug('creating new state for editor', html);
|
|
20210
20435
|
setState(createState(html, decorators));
|
|
20211
20436
|
}, [html, decorators]);
|
|
20212
20437
|
return (React__default.createElement(EditorContext.Provider, { value: {
|
|
20213
|
-
state,
|
|
20214
|
-
setState,
|
|
20215
|
-
selection,
|
|
20216
|
-
setSelection,
|
|
20438
|
+
state: state,
|
|
20439
|
+
setState: setState,
|
|
20440
|
+
selection: selection,
|
|
20441
|
+
setSelection: setSelection,
|
|
20217
20442
|
} }, children));
|
|
20218
20443
|
};
|
|
20219
20444
|
|
|
20220
20445
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
20221
20446
|
|
|
20222
|
-
|
|
20447
|
+
var useButtonStyles = makeStyles()({
|
|
20223
20448
|
btn: {
|
|
20224
20449
|
backgroundColor: 'white',
|
|
20225
20450
|
'&:hover': {
|
|
@@ -20234,114 +20459,121 @@ const useButtonStyles = makeStyles()({
|
|
|
20234
20459
|
},
|
|
20235
20460
|
});
|
|
20236
20461
|
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
?
|
|
20258
|
-
: hex2rgba('#000', 0.23),
|
|
20259
|
-
'&:hover': {
|
|
20462
|
+
var useEditorStyles = makeStyles()(function (theme, _a) {
|
|
20463
|
+
var hasFocus = _a.hasFocus, hasContent = _a.hasContent, readOnly = _a.readOnly;
|
|
20464
|
+
return ({
|
|
20465
|
+
root: {
|
|
20466
|
+
position: 'relative',
|
|
20467
|
+
display: 'inline-flex',
|
|
20468
|
+
flexFlow: 'column',
|
|
20469
|
+
minWidth: '100%', // TODO
|
|
20470
|
+
},
|
|
20471
|
+
legend: {
|
|
20472
|
+
position: 'absolute',
|
|
20473
|
+
top: -5,
|
|
20474
|
+
left: 0,
|
|
20475
|
+
right: 0,
|
|
20476
|
+
bottom: 0,
|
|
20477
|
+
lineHeight: '11px',
|
|
20478
|
+
zIndex: hasFocus ? 0 : 1,
|
|
20479
|
+
paddingLeft: 10,
|
|
20480
|
+
borderStyle: 'solid',
|
|
20481
|
+
borderRadius: theme.shape.borderRadius,
|
|
20482
|
+
borderWidth: hasFocus ? 2 : 1,
|
|
20260
20483
|
borderColor: hasFocus
|
|
20261
20484
|
? theme.palette.primary.main
|
|
20262
|
-
:
|
|
20485
|
+
: hex2rgba('#000', 0.23),
|
|
20486
|
+
'&:hover': {
|
|
20487
|
+
borderColor: hasFocus
|
|
20488
|
+
? theme.palette.primary.main
|
|
20489
|
+
: theme.palette.text.primary,
|
|
20490
|
+
},
|
|
20491
|
+
transition: theme.transitions.create(['border-color'], {
|
|
20492
|
+
duration: theme.transitions.duration.shorter,
|
|
20493
|
+
easing: theme.transitions.easing.easeOut,
|
|
20494
|
+
}),
|
|
20263
20495
|
},
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
position: 'relative',
|
|
20272
|
-
zIndex: hasFocus || readOnly ? 1 : 0,
|
|
20273
|
-
'& .unstyled': {
|
|
20274
|
-
margin: '.5rem 0',
|
|
20496
|
+
editor: {
|
|
20497
|
+
padding: '.8rem 1rem',
|
|
20498
|
+
position: 'relative',
|
|
20499
|
+
zIndex: hasFocus || readOnly ? 1 : 0,
|
|
20500
|
+
'& .unstyled': {
|
|
20501
|
+
margin: '.5rem 0',
|
|
20502
|
+
},
|
|
20275
20503
|
},
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
: '
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
:
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
}
|
|
20321
|
-
})
|
|
20504
|
+
label: {
|
|
20505
|
+
position: 'absolute',
|
|
20506
|
+
top: 0,
|
|
20507
|
+
left: 0,
|
|
20508
|
+
zIndex: 1,
|
|
20509
|
+
transform: hasFocus || hasContent
|
|
20510
|
+
? 'translate(6px, -14px) scale(0.75)'
|
|
20511
|
+
: 'translate(6px, 12px) scale(1)',
|
|
20512
|
+
transformOrigin: 'top left',
|
|
20513
|
+
transition: theme.transitions.create(['color', 'transform'], {
|
|
20514
|
+
duration: theme.transitions.duration.shorter,
|
|
20515
|
+
easing: theme.transitions.easing.easeOut,
|
|
20516
|
+
}),
|
|
20517
|
+
color: hasFocus
|
|
20518
|
+
? theme.palette.primary[theme.palette.mode === 'light' ? 'dark' : 'light']
|
|
20519
|
+
: theme.palette.text.secondary,
|
|
20520
|
+
fontSize: '1.1428571428571428rem',
|
|
20521
|
+
// hack @todo when time
|
|
20522
|
+
backgroundColor: 'white',
|
|
20523
|
+
padding: '2px 10px',
|
|
20524
|
+
},
|
|
20525
|
+
helpertext: {
|
|
20526
|
+
margin: 0,
|
|
20527
|
+
opacity: hasFocus ? 1 : 0,
|
|
20528
|
+
transition: theme.transitions.create(['opacity'], {
|
|
20529
|
+
duration: theme.transitions.duration.shorter,
|
|
20530
|
+
easing: theme.transitions.easing.easeOut,
|
|
20531
|
+
}),
|
|
20532
|
+
fontSize: 'small',
|
|
20533
|
+
// hack @todo when time
|
|
20534
|
+
backgroundColor: 'white',
|
|
20535
|
+
padding: '2px 10px',
|
|
20536
|
+
},
|
|
20537
|
+
charcount: {
|
|
20538
|
+
margin: 0,
|
|
20539
|
+
transition: theme.transitions.create(['opacity'], {
|
|
20540
|
+
duration: theme.transitions.duration.shorter,
|
|
20541
|
+
easing: theme.transitions.easing.easeOut,
|
|
20542
|
+
}),
|
|
20543
|
+
fontSize: 'small',
|
|
20544
|
+
// hack @todo when time
|
|
20545
|
+
backgroundColor: 'white',
|
|
20546
|
+
padding: '2px 10px',
|
|
20547
|
+
},
|
|
20548
|
+
});
|
|
20549
|
+
});
|
|
20322
20550
|
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
? '
|
|
20331
|
-
:
|
|
20332
|
-
|
|
20333
|
-
|
|
20551
|
+
var useFloatingToolbarStyles = makeStyles()(function (_theme, _a) {
|
|
20552
|
+
var isVisible = _a.isVisible;
|
|
20553
|
+
return ({
|
|
20554
|
+
root: {
|
|
20555
|
+
position: 'absolute',
|
|
20556
|
+
zIndex: 9,
|
|
20557
|
+
transition: 'transform 0.15s cubic-bezier(.3,1.2,.2,1)',
|
|
20558
|
+
visibility: isVisible ? 'visible' : 'hidden',
|
|
20559
|
+
transform: isVisible
|
|
20560
|
+
? 'translate(-50%) scale(1)'
|
|
20561
|
+
: 'translate(-50%) scale(0)',
|
|
20562
|
+
},
|
|
20563
|
+
});
|
|
20564
|
+
});
|
|
20334
20565
|
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20566
|
+
var InlineButton = function (_a) {
|
|
20567
|
+
var type = _a.type; _a.editor; var children = _a.children, props = __rest$1(_a, ["type", "editor", "children"]);
|
|
20568
|
+
var classes = useButtonStyles().classes;
|
|
20569
|
+
var _b = useContext(EditorContext), state = _b.state, setState = _b.setState;
|
|
20570
|
+
var onClick = function (event) {
|
|
20339
20571
|
event.preventDefault();
|
|
20340
|
-
|
|
20572
|
+
var e = event;
|
|
20341
20573
|
setState(UpdateStyle(state, e.currentTarget.value));
|
|
20342
20574
|
};
|
|
20343
|
-
|
|
20344
|
-
return (React__default.createElement(ToggleButton, {
|
|
20575
|
+
var selected = state.getCurrentInlineStyle().has(type);
|
|
20576
|
+
return (React__default.createElement(ToggleButton, __assign({}, props, { classes: { root: classes.btn, selected: classes.btnSelected }, selected: selected, onClick: onClick, value: type, size: "small" }), children));
|
|
20345
20577
|
};
|
|
20346
20578
|
|
|
20347
20579
|
var ButtonType;
|
|
@@ -20349,7 +20581,7 @@ var ButtonType;
|
|
|
20349
20581
|
ButtonType["bold"] = "BOLD";
|
|
20350
20582
|
ButtonType["italic"] = "ITALIC";
|
|
20351
20583
|
})(ButtonType || (ButtonType = {}));
|
|
20352
|
-
|
|
20584
|
+
var createButton = function (style) {
|
|
20353
20585
|
switch (style) {
|
|
20354
20586
|
case 'bold':
|
|
20355
20587
|
return {
|
|
@@ -20364,109 +20596,117 @@ const createButton = (style) => {
|
|
|
20364
20596
|
}
|
|
20365
20597
|
};
|
|
20366
20598
|
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20599
|
+
var FloatingToolbar = function (_a) {
|
|
20600
|
+
var editor = _a.editor, buttons = _a.buttons;
|
|
20601
|
+
var selection = useContext(EditorContext).selection;
|
|
20602
|
+
var _b = __read(useState(false), 2), isVisible = _b[0], setVisibility = _b[1];
|
|
20603
|
+
var toolbar = useRef();
|
|
20604
|
+
var classes = useFloatingToolbarStyles({ isVisible: isVisible }).classes;
|
|
20372
20605
|
// @eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20373
|
-
useEffect(()
|
|
20374
|
-
|
|
20606
|
+
useEffect(function () {
|
|
20607
|
+
var _a;
|
|
20608
|
+
var selectionRect = getVisibleSelectionRect(window);
|
|
20375
20609
|
if (!selectionRect || !toolbar.current || !editor.current)
|
|
20376
20610
|
return;
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20611
|
+
var editorRoot = editor.current.editorContainer;
|
|
20612
|
+
var editorRootRect = editorRoot.getBoundingClientRect();
|
|
20613
|
+
var position = {
|
|
20380
20614
|
top: editorRoot.offsetTop -
|
|
20381
|
-
toolbar
|
|
20615
|
+
((_a = toolbar === null || toolbar === void 0 ? void 0 : toolbar.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) +
|
|
20382
20616
|
(selectionRect.top - editorRootRect.top) -
|
|
20383
20617
|
5,
|
|
20384
20618
|
left: editorRoot.offsetLeft +
|
|
20385
20619
|
(selectionRect.left - editorRootRect.left) +
|
|
20386
20620
|
selectionRect.width / 2,
|
|
20387
20621
|
};
|
|
20388
|
-
toolbar.current.style.top =
|
|
20389
|
-
toolbar.current.style.left =
|
|
20622
|
+
toolbar.current.style.top = "".concat(position.top, "px");
|
|
20623
|
+
toolbar.current.style.left = "".concat(position.left, "px");
|
|
20390
20624
|
setVisibility(!!selection && !selection.isCollapsed() && selection.getHasFocus());
|
|
20391
20625
|
});
|
|
20392
20626
|
return (React__default.createElement("div", { ref: toolbar, className: classes.root },
|
|
20393
|
-
React__default.createElement(ToggleButtonGroup, null, buttons.map((
|
|
20627
|
+
React__default.createElement(ToggleButtonGroup, null, buttons.map(function (_a, key) {
|
|
20628
|
+
var type = _a.type, children = _a.children;
|
|
20629
|
+
return (React__default.createElement(InlineButton, { key: key, type: type, editor: editor }, children));
|
|
20630
|
+
}))));
|
|
20394
20631
|
};
|
|
20395
20632
|
|
|
20396
|
-
|
|
20633
|
+
var customKeyHandler = function (setEditorState) { return function (command, editorState) {
|
|
20397
20634
|
if (command === 'shift-split-block') {
|
|
20398
|
-
|
|
20635
|
+
var newState = RichUtils.insertSoftNewline(editorState);
|
|
20399
20636
|
setEditorState(newState);
|
|
20400
20637
|
return 'handled';
|
|
20401
20638
|
}
|
|
20402
20639
|
return 'not-handled';
|
|
20403
|
-
};
|
|
20404
|
-
|
|
20405
|
-
if (!allowedStyles || allowedStyles.some((s)
|
|
20406
|
-
|
|
20640
|
+
}; };
|
|
20641
|
+
var keyHandler = function (setEditorState, allowedStyles) { return function (command, editorState) {
|
|
20642
|
+
if (!allowedStyles || allowedStyles.some(function (s) { return s === command; })) {
|
|
20643
|
+
var newState = RichUtils.handleKeyCommand(editorState, command);
|
|
20407
20644
|
if (newState) {
|
|
20408
20645
|
setEditorState(newState);
|
|
20409
20646
|
return 'handled';
|
|
20410
20647
|
}
|
|
20411
20648
|
}
|
|
20412
20649
|
return customKeyHandler(setEditorState)(command, editorState);
|
|
20413
|
-
};
|
|
20650
|
+
}; };
|
|
20414
20651
|
|
|
20415
|
-
|
|
20416
|
-
|
|
20652
|
+
var blockStyleFn = function (block) { return block.getType(); };
|
|
20653
|
+
var createDefaultButtons = function () { return [
|
|
20417
20654
|
createButton('bold'),
|
|
20418
20655
|
createButton('italic'),
|
|
20419
|
-
];
|
|
20420
|
-
|
|
20421
|
-
|
|
20422
|
-
|
|
20423
|
-
|
|
20424
|
-
|
|
20425
|
-
|
|
20656
|
+
]; };
|
|
20657
|
+
var getCharCount = function (editorState) {
|
|
20658
|
+
return editorState.getCurrentContent().getPlainText('').length;
|
|
20659
|
+
};
|
|
20660
|
+
var EditorComponent = function (_a) {
|
|
20661
|
+
var label = _a.label, classes = _a.classes, autoFocus = _a.autoFocus, helperText = _a.helperText, showCharCount = _a.showCharCount, allowedStyles = _a.allowedStyles, disableNewlines = _a.disableNewlines, onContentChange = _a.onContentChange, _b = _a.Toolbar, Toolbar = _b === void 0 ? FloatingToolbar : _b, blockPasting = _a.blockPasting, lang = _a.lang, props = __rest$1(_a, ["label", "classes", "autoFocus", "helperText", "showCharCount", "allowedStyles", "disableNewlines", "onContentChange", "Toolbar", "blockPasting", "lang"]);
|
|
20662
|
+
var _c = useContext(EditorContext), state = _c.state, setState = _c.setState, setSelection = _c.setSelection;
|
|
20663
|
+
var ref = useRef();
|
|
20664
|
+
var canStyle = allowedStyles === undefined || allowedStyles.length > 0;
|
|
20665
|
+
var buttons = !allowedStyles
|
|
20426
20666
|
? createDefaultButtons()
|
|
20427
20667
|
: allowedStyles.map(createButton);
|
|
20428
20668
|
// TODO: make prop
|
|
20429
|
-
|
|
20669
|
+
var handleKeyCommand = canStyle
|
|
20430
20670
|
? keyHandler(setState, allowedStyles)
|
|
20431
20671
|
: customKeyHandler(setState);
|
|
20432
|
-
|
|
20433
|
-
|
|
20672
|
+
var _d = __read(useState(false), 2), hasFocus = _d[0], setFocused = _d[1];
|
|
20673
|
+
var _e = __read(useState(0), 2), charCount = _e[0], setCharCount = _e[1];
|
|
20434
20674
|
// defer focus until next tick
|
|
20435
|
-
|
|
20436
|
-
window.requestAnimationFrame(()
|
|
20675
|
+
var requestFocus = function () {
|
|
20676
|
+
window.requestAnimationFrame(function () { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
20437
20677
|
};
|
|
20438
20678
|
// multiple components might request focus and deligate back focus
|
|
20439
|
-
|
|
20679
|
+
var onBlur = useDebounce(function () { return ref.current && setFocused(false); }, {
|
|
20440
20680
|
wait: 150,
|
|
20441
20681
|
});
|
|
20442
|
-
|
|
20682
|
+
var onFocus = function () {
|
|
20443
20683
|
// when editor focused cancel pending defocus
|
|
20444
20684
|
onBlur.cancel();
|
|
20445
20685
|
setFocused(true);
|
|
20446
20686
|
};
|
|
20447
|
-
|
|
20687
|
+
var onChange = function (nextState) {
|
|
20448
20688
|
setState(nextState);
|
|
20449
20689
|
setSelection(nextState.getSelection());
|
|
20450
20690
|
setCharCount(getCharCount(nextState));
|
|
20451
20691
|
};
|
|
20452
|
-
useEffect(()
|
|
20692
|
+
useEffect(function () {
|
|
20453
20693
|
autoFocus && ref.current && ref.current.focus();
|
|
20454
20694
|
}, [autoFocus]);
|
|
20455
20695
|
// hacky workaround?
|
|
20456
|
-
|
|
20457
|
-
|
|
20458
|
-
useEffect(()
|
|
20696
|
+
var oldContent = useRef(state.getCurrentContent());
|
|
20697
|
+
var currentContent = state.getCurrentContent();
|
|
20698
|
+
useEffect(function () {
|
|
20459
20699
|
if (oldContent.current !== currentContent) {
|
|
20460
20700
|
onContentChange && onContentChange(currentContent);
|
|
20461
20701
|
}
|
|
20462
20702
|
}, [convert2html(currentContent)]);
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
hasFocus,
|
|
20466
|
-
hasContent,
|
|
20703
|
+
var hasContent = state.getCurrentContent().hasText();
|
|
20704
|
+
var styles = useEditorStyles({
|
|
20705
|
+
hasFocus: hasFocus,
|
|
20706
|
+
hasContent: hasContent,
|
|
20467
20707
|
readOnly: props.readOnly,
|
|
20468
|
-
});
|
|
20469
|
-
|
|
20708
|
+
}).classes;
|
|
20709
|
+
var keyBindingFn = function (e) {
|
|
20470
20710
|
if (disableNewlines && e.key === 'Enter')
|
|
20471
20711
|
return null;
|
|
20472
20712
|
if (e.key === 'Enter' && e.shiftKey) {
|
|
@@ -20476,40 +20716,31 @@ const EditorComponent = ({ label, classes, autoFocus, helperText, showCharCount,
|
|
|
20476
20716
|
return getDefaultKeyBinding(e);
|
|
20477
20717
|
}
|
|
20478
20718
|
};
|
|
20479
|
-
|
|
20719
|
+
var handlePastedText = function (text, _html, editorState) {
|
|
20480
20720
|
if (!blockPasting) {
|
|
20481
20721
|
onChange(EditorState.push(editorState, Modifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), text.replace(/\n/g, ' ')), 'remove-range'));
|
|
20482
20722
|
}
|
|
20483
20723
|
return 'handled';
|
|
20484
20724
|
};
|
|
20485
|
-
return (React__default.createElement(Box, { className: clsx(styles.root, classes
|
|
20486
|
-
React__default.createElement("legend", { className: clsx(styles.legend, classes
|
|
20725
|
+
return (React__default.createElement(Box, { className: clsx(styles.root, classes === null || classes === void 0 ? void 0 : classes.root), onClick: requestFocus },
|
|
20726
|
+
React__default.createElement("legend", { className: clsx(styles.legend, classes === null || classes === void 0 ? void 0 : classes.legend) },
|
|
20487
20727
|
React__default.createElement("span", { dangerouslySetInnerHTML: { __html: '​' } })),
|
|
20488
|
-
label && (React__default.createElement("label", { className: clsx(styles.label, classes
|
|
20728
|
+
label && (React__default.createElement("label", { className: clsx(styles.label, classes === null || classes === void 0 ? void 0 : classes.label) }, label)),
|
|
20489
20729
|
canStyle && (React__default.createElement(Toolbar, { editor: ref, buttons: buttons })),
|
|
20490
|
-
React__default.createElement(Box, { className: clsx(styles.editor, classes
|
|
20491
|
-
React__default.createElement(Editor, { ref: ref,
|
|
20492
|
-
editorState: state,
|
|
20493
|
-
onChange,
|
|
20494
|
-
onFocus,
|
|
20495
|
-
onBlur,
|
|
20496
|
-
blockStyleFn,
|
|
20497
|
-
handleKeyCommand,
|
|
20498
|
-
keyBindingFn,
|
|
20499
|
-
handlePastedText,
|
|
20500
|
-
...props,
|
|
20501
|
-
} })),
|
|
20730
|
+
React__default.createElement(Box, { className: clsx(styles.editor, classes === null || classes === void 0 ? void 0 : classes.editor), lang: lang },
|
|
20731
|
+
React__default.createElement(Editor, __assign({ ref: ref }, __assign({ editorState: state, onChange: onChange, onFocus: onFocus, onBlur: onBlur, blockStyleFn: blockStyleFn, handleKeyCommand: handleKeyCommand, keyBindingFn: keyBindingFn, handlePastedText: handlePastedText }, props)))),
|
|
20502
20732
|
(showCharCount || helperText) && (React__default.createElement(Box, { margin: ".5rem" },
|
|
20503
|
-
showCharCount && (React__default.createElement(FormHelperText, { className: styles.charcount },
|
|
20733
|
+
showCharCount && (React__default.createElement(FormHelperText, { className: styles.charcount }, "Antall tegn: ".concat(charCount))),
|
|
20504
20734
|
helperText && (React__default.createElement(FormHelperText, { className: styles.helpertext }, helperText))))));
|
|
20505
20735
|
};
|
|
20506
20736
|
|
|
20507
|
-
|
|
20508
|
-
|
|
20509
|
-
|
|
20737
|
+
var GrepEditor = function (_a) {
|
|
20738
|
+
var html = _a.html, props = __rest$1(_a, ["html"]);
|
|
20739
|
+
return (React__default.createElement(Provider, __assign({}, { html: html }),
|
|
20740
|
+
React__default.createElement(EditorComponent, __assign({}, props))));
|
|
20510
20741
|
};
|
|
20511
20742
|
|
|
20512
|
-
|
|
20743
|
+
var dimensions = {
|
|
20513
20744
|
breadcrumbsFontSize: 16,
|
|
20514
20745
|
contentWidth: 1028,
|
|
20515
20746
|
footerHeight: 50,
|
|
@@ -20520,7 +20751,7 @@ const dimensions = {
|
|
|
20520
20751
|
toolbarMenuWidth: 1028,
|
|
20521
20752
|
toolbarMenuHeight: 50,
|
|
20522
20753
|
};
|
|
20523
|
-
|
|
20754
|
+
var ToolbarTitle = styled(NavLink)(function () { return ({
|
|
20524
20755
|
display: 'flex',
|
|
20525
20756
|
fontSize: '24px',
|
|
20526
20757
|
color: '#303030',
|
|
@@ -20534,84 +20765,102 @@ const ToolbarTitle = styled(NavLink)(() => ({
|
|
|
20534
20765
|
outline: 'none',
|
|
20535
20766
|
textDecoration: 'underline',
|
|
20536
20767
|
},
|
|
20537
|
-
}));
|
|
20538
|
-
|
|
20768
|
+
}); });
|
|
20769
|
+
var EnvironmentTitle = styled('div')(function () { return ({
|
|
20539
20770
|
color: 'rgba(0, 0, 0, 0.33)',
|
|
20540
20771
|
marginLeft: '17px',
|
|
20541
|
-
}));
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
20569
|
-
|
|
20570
|
-
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20772
|
+
}); });
|
|
20773
|
+
var Toolbar = styled('div')(function (_a) {
|
|
20774
|
+
var _b;
|
|
20775
|
+
var theme = _a.theme;
|
|
20776
|
+
return (_b = {
|
|
20777
|
+
display: 'flex',
|
|
20778
|
+
flexDirection: 'column'
|
|
20779
|
+
},
|
|
20780
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20781
|
+
height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20782
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20783
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20784
|
+
},
|
|
20785
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20786
|
+
height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20787
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20788
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20789
|
+
},
|
|
20790
|
+
_b);
|
|
20791
|
+
});
|
|
20792
|
+
var ToolbarFixer = styled('div')(function (_a) {
|
|
20793
|
+
var _b;
|
|
20794
|
+
var theme = _a.theme;
|
|
20795
|
+
return (_b = {
|
|
20796
|
+
display: 'flex',
|
|
20797
|
+
flexDirection: 'column',
|
|
20798
|
+
position: 'fixed',
|
|
20799
|
+
top: 0,
|
|
20800
|
+
left: 0,
|
|
20801
|
+
right: 0,
|
|
20802
|
+
zIndex: 101
|
|
20803
|
+
},
|
|
20804
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20805
|
+
height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20806
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20807
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeightMobile, "px"),
|
|
20808
|
+
},
|
|
20809
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20810
|
+
height: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20811
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20812
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight + dimensions.toolbarHeight, "px"),
|
|
20813
|
+
},
|
|
20814
|
+
_b);
|
|
20815
|
+
});
|
|
20816
|
+
var ToolbarInner = styled('div')(function (_a) {
|
|
20817
|
+
var _b;
|
|
20818
|
+
var colors = _a.colors, theme = _a.theme;
|
|
20576
20819
|
if (!theme) {
|
|
20577
20820
|
return {};
|
|
20578
20821
|
}
|
|
20579
|
-
return {
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20583
|
-
|
|
20584
|
-
|
|
20585
|
-
|
|
20586
|
-
|
|
20587
|
-
|
|
20588
|
-
|
|
20822
|
+
return _b = {
|
|
20823
|
+
alignItems: 'center',
|
|
20824
|
+
display: 'flex',
|
|
20825
|
+
margin: '0 auto',
|
|
20826
|
+
width: '100%',
|
|
20827
|
+
padding: 0,
|
|
20828
|
+
backgroundColor: colors.headerBackgroundColor
|
|
20829
|
+
},
|
|
20830
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20831
|
+
height: "".concat(dimensions.toolbarHeightMobile, "px"),
|
|
20832
|
+
minHeight: "".concat(dimensions.toolbarHeightMobile, "px"),
|
|
20589
20833
|
},
|
|
20590
|
-
[theme.breakpoints.up('sm')]
|
|
20834
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20591
20835
|
padding: 0,
|
|
20592
|
-
height:
|
|
20593
|
-
minHeight:
|
|
20836
|
+
height: "".concat(dimensions.toolbarHeight, "px"),
|
|
20837
|
+
minHeight: "".concat(dimensions.toolbarHeight, "px"),
|
|
20594
20838
|
},
|
|
20595
|
-
|
|
20839
|
+
_b;
|
|
20596
20840
|
});
|
|
20597
|
-
|
|
20841
|
+
var ToolbarLeft = styled('div')(function () { return ({
|
|
20598
20842
|
alignItems: 'center',
|
|
20599
20843
|
display: 'flex',
|
|
20600
20844
|
marginLeft: '40px',
|
|
20601
|
-
}));
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
|
|
20606
|
-
|
|
20607
|
-
|
|
20608
|
-
|
|
20609
|
-
|
|
20610
|
-
|
|
20611
|
-
|
|
20612
|
-
|
|
20613
|
-
}
|
|
20614
|
-
|
|
20845
|
+
}); });
|
|
20846
|
+
var ToolbarRight = styled('div')(function (_a) {
|
|
20847
|
+
var _b;
|
|
20848
|
+
var theme = _a.theme;
|
|
20849
|
+
return (_b = {
|
|
20850
|
+
alignItems: 'center',
|
|
20851
|
+
display: 'flex',
|
|
20852
|
+
marginLeft: 'auto',
|
|
20853
|
+
marginRight: '40px'
|
|
20854
|
+
},
|
|
20855
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20856
|
+
display: 'none',
|
|
20857
|
+
},
|
|
20858
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20859
|
+
display: 'flex',
|
|
20860
|
+
},
|
|
20861
|
+
_b);
|
|
20862
|
+
});
|
|
20863
|
+
var UserContainer = styled('div')(function () { return ({
|
|
20615
20864
|
display: 'flex',
|
|
20616
20865
|
flexDirection: 'column',
|
|
20617
20866
|
margin: '0 17px',
|
|
@@ -20619,117 +20868,133 @@ const UserContainer = styled('div')(() => ({
|
|
|
20619
20868
|
textTransform: 'none',
|
|
20620
20869
|
fontWeight: '400',
|
|
20621
20870
|
color: 'rgba(0, 0, 0, 0.87)',
|
|
20622
|
-
}));
|
|
20623
|
-
|
|
20871
|
+
}); });
|
|
20872
|
+
var AccountName = styled('span')(function () { return ({
|
|
20624
20873
|
fontSize: '18px',
|
|
20625
20874
|
lineHeight: '25px',
|
|
20626
|
-
}));
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
|
|
20637
|
-
|
|
20638
|
-
|
|
20875
|
+
}); });
|
|
20876
|
+
var ToolbarMenu = styled('div')(function (_a) {
|
|
20877
|
+
var _b;
|
|
20878
|
+
var theme = _a.theme;
|
|
20879
|
+
return _b = {
|
|
20880
|
+
backgroundColor: theme.palette.primary.main,
|
|
20881
|
+
height: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20882
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20883
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20884
|
+
width: '100%',
|
|
20885
|
+
display: 'flex',
|
|
20886
|
+
alignItems: 'center',
|
|
20887
|
+
fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
|
|
20888
|
+
boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)'
|
|
20889
|
+
},
|
|
20890
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20639
20891
|
display: 'none',
|
|
20640
20892
|
},
|
|
20641
|
-
[theme.breakpoints.up('sm')]
|
|
20893
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20642
20894
|
display: 'flex',
|
|
20643
20895
|
},
|
|
20644
|
-
|
|
20896
|
+
_b;
|
|
20645
20897
|
});
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
[theme.breakpoints.up('sm')]: {
|
|
20660
|
-
display: 'none',
|
|
20661
|
-
},
|
|
20662
|
-
}));
|
|
20663
|
-
const ToolbarMenuInner = styled('div')(({ theme }) => ({
|
|
20664
|
-
display: 'flex',
|
|
20665
|
-
height: 'fit-content',
|
|
20666
|
-
maxWidth: `${dimensions.toolbarMenuWidth}px`,
|
|
20667
|
-
margin: '0 auto',
|
|
20668
|
-
[theme.breakpoints.down('lg')]: {
|
|
20669
|
-
padding: '0 24px',
|
|
20670
|
-
},
|
|
20671
|
-
[theme.breakpoints.up('lg')]: {
|
|
20672
|
-
padding: 0,
|
|
20673
|
-
},
|
|
20674
|
-
}));
|
|
20675
|
-
const menuItemHoverGreen = '#B9E1CC';
|
|
20676
|
-
const ToolbarMenuItem = styled(NavLink)(({ theme }) => ({
|
|
20677
|
-
alignItems: 'center',
|
|
20678
|
-
borderRight: '1px solid #696868',
|
|
20679
|
-
color: theme.palette.background.default,
|
|
20680
|
-
cursor: 'pointer',
|
|
20681
|
-
display: 'flex',
|
|
20682
|
-
fontSize: '16px',
|
|
20683
|
-
padding: '0 17px',
|
|
20684
|
-
height: '100%',
|
|
20685
|
-
textTransform: 'capitalize',
|
|
20686
|
-
userSelect: 'none',
|
|
20687
|
-
position: 'relative',
|
|
20688
|
-
textDecoration: 'none',
|
|
20689
|
-
fontWeight: 500,
|
|
20690
|
-
':first-child': {
|
|
20691
|
-
paddingLeft: 0,
|
|
20692
|
-
':after': {
|
|
20693
|
-
marginLeft: '-24px',
|
|
20898
|
+
var MobileToolbarMenu = styled('div')(function (_a) {
|
|
20899
|
+
var _b;
|
|
20900
|
+
var theme = _a.theme;
|
|
20901
|
+
return (_b = {
|
|
20902
|
+
backgroundColor: theme.palette.primary.main,
|
|
20903
|
+
height: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20904
|
+
maxHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20905
|
+
minHeight: "".concat(dimensions.toolbarMenuHeight, "px"),
|
|
20906
|
+
width: '100%',
|
|
20907
|
+
flexGrow: 1,
|
|
20908
|
+
alignItems: 'center',
|
|
20909
|
+
fontFamily: 'MontSerrat, Helvetica Neue, Helvetica, Arial, sans-serif',
|
|
20910
|
+
boxShadow: '0 3px 5px 0 rgba(0, 0, 0, 0.3)'
|
|
20694
20911
|
},
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
borderRight: 'none',
|
|
20698
|
-
},
|
|
20699
|
-
':after': {
|
|
20700
|
-
position: 'absolute',
|
|
20701
|
-
bottom: 0,
|
|
20702
|
-
left: '50%',
|
|
20703
|
-
width: '32px',
|
|
20704
|
-
marginLeft: '-16px',
|
|
20705
|
-
borderBottom: `2px solid ${theme.palette.secondary.light}`,
|
|
20706
|
-
opacity: 0,
|
|
20707
|
-
content: '""',
|
|
20708
|
-
transition: 'all 0.3s ease',
|
|
20709
|
-
pointerEvents: 'none',
|
|
20710
|
-
},
|
|
20711
|
-
':focus': {
|
|
20712
|
-
outline: 'none',
|
|
20713
|
-
color: menuItemHoverGreen,
|
|
20714
|
-
':after': {
|
|
20715
|
-
bottom: '-4px',
|
|
20716
|
-
opacity: '1',
|
|
20912
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
20913
|
+
display: 'flex',
|
|
20717
20914
|
},
|
|
20718
|
-
|
|
20719
|
-
|
|
20915
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
20916
|
+
display: 'none',
|
|
20917
|
+
},
|
|
20918
|
+
_b);
|
|
20919
|
+
});
|
|
20920
|
+
var ToolbarMenuInner = styled('div')(function (_a) {
|
|
20921
|
+
var _b;
|
|
20922
|
+
var theme = _a.theme;
|
|
20923
|
+
return (_b = {
|
|
20924
|
+
display: 'flex',
|
|
20925
|
+
height: 'fit-content',
|
|
20926
|
+
maxWidth: "".concat(dimensions.toolbarMenuWidth, "px"),
|
|
20927
|
+
margin: '0 auto'
|
|
20928
|
+
},
|
|
20929
|
+
_b[theme.breakpoints.down('lg')] = {
|
|
20930
|
+
padding: '0 24px',
|
|
20931
|
+
},
|
|
20932
|
+
_b[theme.breakpoints.up('lg')] = {
|
|
20933
|
+
padding: 0,
|
|
20934
|
+
},
|
|
20935
|
+
_b);
|
|
20936
|
+
});
|
|
20937
|
+
var menuItemHoverGreen = '#B9E1CC';
|
|
20938
|
+
var ToolbarMenuItem = styled(NavLink)(function (_a) {
|
|
20939
|
+
var theme = _a.theme;
|
|
20940
|
+
return ({
|
|
20941
|
+
alignItems: 'center',
|
|
20942
|
+
borderRight: '1px solid #696868',
|
|
20943
|
+
color: theme.palette.background.default,
|
|
20944
|
+
cursor: 'pointer',
|
|
20945
|
+
display: 'flex',
|
|
20946
|
+
fontSize: '16px',
|
|
20947
|
+
padding: '0 17px',
|
|
20948
|
+
height: '100%',
|
|
20949
|
+
textTransform: 'capitalize',
|
|
20950
|
+
userSelect: 'none',
|
|
20951
|
+
position: 'relative',
|
|
20720
20952
|
textDecoration: 'none',
|
|
20721
|
-
|
|
20953
|
+
fontWeight: 500,
|
|
20954
|
+
':first-child': {
|
|
20955
|
+
paddingLeft: 0,
|
|
20956
|
+
':after': {
|
|
20957
|
+
marginLeft: '-24px',
|
|
20958
|
+
},
|
|
20959
|
+
},
|
|
20960
|
+
':last-child': {
|
|
20961
|
+
borderRight: 'none',
|
|
20962
|
+
},
|
|
20722
20963
|
':after': {
|
|
20964
|
+
position: 'absolute',
|
|
20965
|
+
bottom: 0,
|
|
20966
|
+
left: '50%',
|
|
20967
|
+
width: '32px',
|
|
20968
|
+
marginLeft: '-16px',
|
|
20969
|
+
borderBottom: "2px solid ".concat(theme.palette.secondary.light),
|
|
20970
|
+
opacity: 0,
|
|
20971
|
+
content: '""',
|
|
20972
|
+
transition: 'all 0.3s ease',
|
|
20973
|
+
pointerEvents: 'none',
|
|
20974
|
+
},
|
|
20975
|
+
':focus': {
|
|
20976
|
+
outline: 'none',
|
|
20977
|
+
color: menuItemHoverGreen,
|
|
20978
|
+
':after': {
|
|
20979
|
+
bottom: '-4px',
|
|
20980
|
+
opacity: '1',
|
|
20981
|
+
},
|
|
20982
|
+
},
|
|
20983
|
+
':hover': {
|
|
20984
|
+
textDecoration: 'none',
|
|
20985
|
+
color: menuItemHoverGreen,
|
|
20986
|
+
':after': {
|
|
20987
|
+
bottom: '-4px',
|
|
20988
|
+
opacity: '1',
|
|
20989
|
+
},
|
|
20990
|
+
},
|
|
20991
|
+
'.active:after': {
|
|
20723
20992
|
bottom: '-4px',
|
|
20724
20993
|
opacity: '1',
|
|
20725
20994
|
},
|
|
20726
|
-
}
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
opacity: '1',
|
|
20730
|
-
},
|
|
20731
|
-
}));
|
|
20732
|
-
const MobileToolbarMenuItem = styled(NavLink)(() => ({
|
|
20995
|
+
});
|
|
20996
|
+
});
|
|
20997
|
+
var MobileToolbarMenuItem = styled(NavLink)(function () { return ({
|
|
20733
20998
|
alignItems: 'center',
|
|
20734
20999
|
color: 'black',
|
|
20735
21000
|
cursor: 'pointer',
|
|
@@ -20739,23 +21004,24 @@ const MobileToolbarMenuItem = styled(NavLink)(() => ({
|
|
|
20739
21004
|
userSelect: 'none',
|
|
20740
21005
|
position: 'relative',
|
|
20741
21006
|
textDecoration: 'none',
|
|
20742
|
-
}));
|
|
21007
|
+
}); });
|
|
20743
21008
|
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
21009
|
+
var MobileAppBar = function (_a) {
|
|
21010
|
+
var userMenuItems = _a.userMenuItems, menuItems = _a.menuItems;
|
|
21011
|
+
var _b = __read(React.useState(null), 2), anchorElNav = _b[0], setAnchorElNav = _b[1];
|
|
21012
|
+
var openNav = Boolean(anchorElNav);
|
|
21013
|
+
var handleClickNav = function (event) {
|
|
20748
21014
|
setAnchorElNav(event.currentTarget);
|
|
20749
21015
|
};
|
|
20750
|
-
|
|
21016
|
+
var handleCloseNav = function () {
|
|
20751
21017
|
setAnchorElNav(null);
|
|
20752
21018
|
};
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
21019
|
+
var _c = __read(React.useState(null), 2), anchorElMenu = _c[0], setAnchorElMenu = _c[1];
|
|
21020
|
+
var openMenu = Boolean(anchorElMenu);
|
|
21021
|
+
var handleClickMenu = function (event) {
|
|
20756
21022
|
setAnchorElMenu(event.currentTarget);
|
|
20757
21023
|
};
|
|
20758
|
-
|
|
21024
|
+
var handleCloseMenu = function () {
|
|
20759
21025
|
setAnchorElMenu(null);
|
|
20760
21026
|
};
|
|
20761
21027
|
return (React.createElement(MobileToolbarMenu, { style: { flexGrow: 1 } },
|
|
@@ -20765,39 +21031,40 @@ const MobileAppBar = ({ userMenuItems, menuItems, }) => {
|
|
|
20765
21031
|
React.createElement(Menu$1, { sx: { color: 'white' } })),
|
|
20766
21032
|
React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElNav, open: openNav, onClose: handleCloseNav, MenuListProps: {
|
|
20767
21033
|
'aria-labelledby': 'basic-button',
|
|
20768
|
-
} }, menuItems.map((page)
|
|
21034
|
+
} }, menuItems.map(function (page) { return (React.createElement(MobileToolbarMenuItem, { key: page.name, to: page.redirectUrl || '' },
|
|
20769
21035
|
React.createElement(MenuItem, { sx: {
|
|
20770
21036
|
width: '100%',
|
|
20771
|
-
}, key: page.name }, page.translatedTextRef))))),
|
|
21037
|
+
}, key: page.name }, page.translatedTextRef))); })),
|
|
20772
21038
|
React.createElement(IconButton, { size: "medium", edge: "end", color: "inherit", "aria-label": "menu", style: { marginLeft: 'auto' }, onClick: handleClickMenu },
|
|
20773
21039
|
React.createElement(MoreVert, { sx: { color: 'white' } })),
|
|
20774
21040
|
React.createElement(Menu, { id: "basic-menu", anchorEl: anchorElMenu, open: openMenu, onClose: handleCloseMenu, MenuListProps: {
|
|
20775
21041
|
'aria-labelledby': 'basic-button',
|
|
20776
|
-
} }, userMenuItems.map((i, index)
|
|
20777
|
-
React.createElement(MenuItem, { key: i.id, onClick: ()
|
|
21042
|
+
} }, userMenuItems.map(function (i, index) { return (React.createElement(Box, { key: i.id },
|
|
21043
|
+
React.createElement(MenuItem, { key: i.id, onClick: function () {
|
|
20778
21044
|
handleCloseMenu();
|
|
20779
21045
|
i.action && i.action();
|
|
20780
21046
|
} }, i.isAnchor ? (React.createElement("a", { style: {
|
|
20781
21047
|
textDecoration: 'inherit',
|
|
20782
21048
|
color: 'inherit',
|
|
20783
21049
|
}, rel: "noreferrer", href: i.href }, i.label)) : (i.label)),
|
|
20784
|
-
userMenuItems.length > index + 1 && React.createElement(Divider, null)))))))));
|
|
21050
|
+
userMenuItems.length > index + 1 && React.createElement(Divider, null))); }))))));
|
|
20785
21051
|
};
|
|
20786
21052
|
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
21053
|
+
var AppBar = function (_a) {
|
|
21054
|
+
var username = _a.username, currentPath = _a.currentPath, isProd = _a.isProd, appTitle = _a.appTitle, userMenuItems = _a.userMenuItems, menuItems = _a.menuItems, userRole = _a.userRole, colors = _a.colors;
|
|
21055
|
+
var _b = __read(React.useState(null), 2), userMenuAnchor = _b[0], setUserMenuAnchor = _b[1];
|
|
21056
|
+
var _handleIconButtonClick = function (event) {
|
|
20790
21057
|
event.preventDefault();
|
|
20791
21058
|
setUserMenuAnchor(event.currentTarget);
|
|
20792
21059
|
};
|
|
20793
|
-
|
|
21060
|
+
var _handleCloseUserMenu = function () {
|
|
20794
21061
|
setUserMenuAnchor(null);
|
|
20795
21062
|
};
|
|
20796
|
-
|
|
20797
|
-
|
|
21063
|
+
var _renderToolbarMenuItem = function (page) {
|
|
21064
|
+
var isActive = (page === null || page === void 0 ? void 0 : page.exact)
|
|
20798
21065
|
? currentPath === page.redirectUrl
|
|
20799
21066
|
: currentPath.includes(page.redirectUrl || '');
|
|
20800
|
-
return (React.createElement(ToolbarMenuItem, { className: isActive ? 'active' : '', to: page.redirectUrl || '', key: page.name, tabIndex: 0 }, page
|
|
21067
|
+
return (React.createElement(ToolbarMenuItem, { className: isActive ? 'active' : '', to: page.redirectUrl || '', key: page.name, tabIndex: 0 }, page === null || page === void 0 ? void 0 : page.translatedTextRef));
|
|
20801
21068
|
};
|
|
20802
21069
|
return (React.createElement(Toolbar, null,
|
|
20803
21070
|
React.createElement(ToolbarFixer, null,
|
|
@@ -20819,8 +21086,8 @@ const AppBar = ({ username, currentPath, isProd, appTitle, userMenuItems, menuIt
|
|
|
20819
21086
|
}, transformOrigin: {
|
|
20820
21087
|
vertical: 'top',
|
|
20821
21088
|
horizontal: 'center',
|
|
20822
|
-
} }, userMenuItems.map((i, index)
|
|
20823
|
-
return (React.createElement(MenuItem$1, { key: i.id, onClick: ()
|
|
21089
|
+
} }, userMenuItems.map(function (i, index) {
|
|
21090
|
+
return (React.createElement(MenuItem$1, { key: i.id, onClick: function () {
|
|
20824
21091
|
setUserMenuAnchor(null);
|
|
20825
21092
|
i.action && i.action();
|
|
20826
21093
|
}, divider: userMenuItems.length > index + 1, sx: {
|
|
@@ -20833,35 +21100,36 @@ const AppBar = ({ username, currentPath, isProd, appTitle, userMenuItems, menuIt
|
|
|
20833
21100
|
}, rel: "noreferrer", href: i.href, onClick: i.onClick }, i.label)) : (i.label)));
|
|
20834
21101
|
})))),
|
|
20835
21102
|
React.createElement(ToolbarMenu, { role: "navigation" },
|
|
20836
|
-
React.createElement(ToolbarMenuInner, null, menuItems.map((page)
|
|
21103
|
+
React.createElement(ToolbarMenuInner, null, menuItems.map(function (page) { return _renderToolbarMenuItem(page); }))),
|
|
20837
21104
|
React.createElement(MobileAppBar, { menuItems: menuItems, userMenuItems: userMenuItems, colors: colors }))));
|
|
20838
21105
|
};
|
|
20839
21106
|
|
|
20840
|
-
|
|
20841
|
-
|
|
20842
|
-
|
|
20843
|
-
|
|
20844
|
-
|
|
20845
|
-
|
|
21107
|
+
var NavGuard = function (_a) {
|
|
21108
|
+
var when = _a.when, title = _a.title, txt = _a.txt, txtSave = _a.txtSave, txtCancel = _a.txtCancel, txtDiscard = _a.txtDiscard, onSave = _a.onSave, onCancel = _a.onCancel, onDiscard = _a.onDiscard;
|
|
21109
|
+
var _b = __read(React.useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
21110
|
+
var _c = __read(React.useState(false), 2), leave = _c[0], setLeave = _c[1];
|
|
21111
|
+
var _d = __read(React.useState(), 2), lastLocation = _d[0], setLastLocation = _d[1];
|
|
21112
|
+
var dispatch = useDispatch();
|
|
21113
|
+
var handleCancel = function () {
|
|
20846
21114
|
setLeave(false);
|
|
20847
21115
|
setOpen(false);
|
|
20848
21116
|
onCancel && onCancel();
|
|
20849
21117
|
};
|
|
20850
|
-
|
|
21118
|
+
var handleDiscard = function () {
|
|
20851
21119
|
setLeave(true);
|
|
20852
21120
|
setOpen(false);
|
|
20853
21121
|
onDiscard && onDiscard();
|
|
20854
21122
|
lastLocation &&
|
|
20855
|
-
window.requestAnimationFrame(()
|
|
21123
|
+
window.requestAnimationFrame(function () { return dispatch(push(lastLocation)); });
|
|
20856
21124
|
};
|
|
20857
|
-
|
|
21125
|
+
var handleSave = function () {
|
|
20858
21126
|
onSave && onSave();
|
|
20859
21127
|
setLeave(true);
|
|
20860
21128
|
setOpen(false);
|
|
20861
21129
|
lastLocation &&
|
|
20862
|
-
window.requestAnimationFrame(()
|
|
21130
|
+
window.requestAnimationFrame(function () { return dispatch(push(lastLocation)); });
|
|
20863
21131
|
};
|
|
20864
|
-
|
|
21132
|
+
var handleLeave = function (location) {
|
|
20865
21133
|
setLastLocation(location);
|
|
20866
21134
|
setOpen(!leave);
|
|
20867
21135
|
return !!leave;
|
|
@@ -20878,17 +21146,21 @@ const NavGuard = ({ when, title, txt, txtSave, txtCancel, txtDiscard, onSave, on
|
|
|
20878
21146
|
onSave && (React.createElement(Button, { onClick: handleSave, color: "primary" }, txtSave))))));
|
|
20879
21147
|
};
|
|
20880
21148
|
|
|
20881
|
-
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
21149
|
+
var useStyles$3 = makeStyles()(function (_a) {
|
|
21150
|
+
var palette = _a.palette;
|
|
21151
|
+
return ({
|
|
21152
|
+
discard: {
|
|
21153
|
+
color: palette.error.main,
|
|
21154
|
+
'&:hover': {
|
|
21155
|
+
backgroundColor: hex2rgba(palette.error.main, 0.1),
|
|
21156
|
+
},
|
|
20886
21157
|
},
|
|
20887
|
-
}
|
|
20888
|
-
})
|
|
21158
|
+
});
|
|
21159
|
+
});
|
|
20889
21160
|
|
|
20890
|
-
|
|
20891
|
-
|
|
21161
|
+
var ConfirmationDialog = function (_a) {
|
|
21162
|
+
var open = _a.open, title = _a.title, description = _a.description, warning = _a.warning, onSubmit = _a.onSubmit, onCancel = _a.onCancel, _b = _a.confirmText, confirmText = _b === void 0 ? 'OK' : _b, _c = _a.cancelText, cancelText = _c === void 0 ? 'Avbryt' : _c;
|
|
21163
|
+
var classes = useStyles$3().classes;
|
|
20892
21164
|
return (React__default.createElement(Dialog, { open: open },
|
|
20893
21165
|
React__default.createElement(DialogTitle, null, title),
|
|
20894
21166
|
React__default.createElement(DialogContent, null,
|
|
@@ -20898,56 +21170,62 @@ const ConfirmationDialog = ({ open, title, description, warning, onSubmit, onCan
|
|
|
20898
21170
|
React__default.createElement(Button, { className: warning ? classes.discard : '', onClick: onSubmit }, confirmText))));
|
|
20899
21171
|
};
|
|
20900
21172
|
|
|
20901
|
-
|
|
20902
|
-
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
|
|
21173
|
+
var ConfirmationServiceContext = React__default.createContext(Promise.reject);
|
|
21174
|
+
var ConfirmationServiceProvider = function (_a) {
|
|
21175
|
+
var children = _a.children;
|
|
21176
|
+
var _b = __read(React__default.useState(null), 2), confirmationState = _b[0], setConfirmationState = _b[1];
|
|
21177
|
+
var _c = __read(React__default.useState(false), 2), dialogOpen = _c[0], setDialogOpen = _c[1];
|
|
21178
|
+
var awaitingPromiseRef = React__default.useRef();
|
|
21179
|
+
var openDialog = function (options) {
|
|
20907
21180
|
setConfirmationState(options);
|
|
20908
21181
|
setDialogOpen(true);
|
|
20909
|
-
return new Promise((resolve, reject)
|
|
20910
|
-
awaitingPromiseRef.current = { resolve, reject };
|
|
21182
|
+
return new Promise(function (resolve, reject) {
|
|
21183
|
+
awaitingPromiseRef.current = { resolve: resolve, reject: reject };
|
|
20911
21184
|
});
|
|
20912
21185
|
};
|
|
20913
|
-
|
|
21186
|
+
var handleCancel = function () {
|
|
20914
21187
|
setDialogOpen(false);
|
|
20915
21188
|
};
|
|
20916
|
-
|
|
20917
|
-
|
|
21189
|
+
var handleSubmit = function () {
|
|
21190
|
+
var _a;
|
|
21191
|
+
(_a = awaitingPromiseRef.current) === null || _a === void 0 ? void 0 : _a.resolve();
|
|
20918
21192
|
setDialogOpen(false);
|
|
20919
21193
|
};
|
|
20920
21194
|
return (React__default.createElement(ConfirmationServiceContext.Provider, { value: openDialog },
|
|
20921
|
-
React__default.createElement(ConfirmationDialog, { open: dialogOpen, onSubmit: handleSubmit, onCancel: handleCancel,
|
|
21195
|
+
React__default.createElement(ConfirmationDialog, __assign({ open: dialogOpen, onSubmit: handleSubmit, onCancel: handleCancel }, confirmationState)),
|
|
20922
21196
|
children));
|
|
20923
21197
|
};
|
|
20924
|
-
|
|
21198
|
+
var useConfirmation = function () {
|
|
21199
|
+
return React__default.useContext(ConfirmationServiceContext);
|
|
21200
|
+
};
|
|
20925
21201
|
|
|
20926
|
-
|
|
20927
|
-
|
|
21202
|
+
var GrepDialog = function (_a) {
|
|
21203
|
+
var open = _a.open, title = _a.title, content = _a.content, onClose = _a.onClose, _b = _a.closeBtnText, closeBtnText = _b === void 0 ? 'Lukk' : _b, props = __rest$1(_a, ["open", "title", "content", "onClose", "closeBtnText"]);
|
|
21204
|
+
var actions = [
|
|
20928
21205
|
React__default.createElement(Button, { key: "OK", color: "primary", onClick: onClose }, closeBtnText),
|
|
20929
21206
|
];
|
|
20930
21207
|
if (props.actions)
|
|
20931
|
-
actions.push(
|
|
21208
|
+
actions.push.apply(actions, __spreadArray([], __read(props.actions), false));
|
|
20932
21209
|
return (React__default.createElement(Dialog, { open: open, onClose: onClose },
|
|
20933
21210
|
React__default.createElement(DialogTitle, null, title),
|
|
20934
21211
|
React__default.createElement(DialogContent, null, content),
|
|
20935
|
-
React__default.createElement(DialogActions, null, actions.map((action)
|
|
21212
|
+
React__default.createElement(DialogActions, null, actions.map(function (action) { return action; }))));
|
|
20936
21213
|
};
|
|
20937
21214
|
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
21215
|
+
var GrepDialogServiceContext = React__default.createContext(function () { return null; });
|
|
21216
|
+
var GrepDialogServiceProvider = function (_a) {
|
|
21217
|
+
var children = _a.children;
|
|
21218
|
+
var _b = __read(React__default.useState(false), 2), dialogOpen = _b[0], setDialogOpen = _b[1];
|
|
21219
|
+
var _c = __read(React__default.useState({}), 2), dialogState = _c[0], setDialogState = _c[1];
|
|
21220
|
+
var openDialog = function (options) {
|
|
20943
21221
|
setDialogState(options);
|
|
20944
21222
|
setDialogOpen(true);
|
|
20945
21223
|
};
|
|
20946
21224
|
return (React__default.createElement(GrepDialogServiceContext.Provider, { value: openDialog },
|
|
20947
|
-
React__default.createElement(GrepDialog, { open: dialogOpen, onClose: ()
|
|
21225
|
+
React__default.createElement(GrepDialog, __assign({ open: dialogOpen, onClose: function () { return setDialogOpen(false); } }, dialogState)),
|
|
20948
21226
|
children));
|
|
20949
21227
|
};
|
|
20950
|
-
|
|
21228
|
+
var useGrepDialog = function () { return React__default.useContext(GrepDialogServiceContext); };
|
|
20951
21229
|
|
|
20952
21230
|
/**
|
|
20953
21231
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -21389,89 +21667,89 @@ function toNumber(value) {
|
|
|
21389
21667
|
|
|
21390
21668
|
var lodash_throttle = throttle;
|
|
21391
21669
|
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21670
|
+
var generateElementId = function (element) {
|
|
21671
|
+
var tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
|
|
21672
|
+
var id = tmpId, index = 1;
|
|
21395
21673
|
while (document.getElementById(id)) {
|
|
21396
|
-
id =
|
|
21674
|
+
id = "".concat(tmpId, "-").concat(++index);
|
|
21397
21675
|
}
|
|
21398
21676
|
return id;
|
|
21399
21677
|
};
|
|
21400
|
-
|
|
21678
|
+
var identifyElement = function (identify) {
|
|
21401
21679
|
identify = identify || generateElementId;
|
|
21402
|
-
return (element)
|
|
21680
|
+
return function (element) {
|
|
21403
21681
|
!element.id && (element.id = identify(element));
|
|
21404
21682
|
return element.id;
|
|
21405
21683
|
};
|
|
21406
21684
|
};
|
|
21407
21685
|
|
|
21408
|
-
|
|
21686
|
+
var initial = {
|
|
21409
21687
|
elements: {},
|
|
21410
|
-
setSelected: ()
|
|
21688
|
+
setSelected: function () {
|
|
21411
21689
|
throw Error('not implemented');
|
|
21412
21690
|
},
|
|
21413
21691
|
};
|
|
21414
|
-
|
|
21692
|
+
var context = React__default.createContext(initial);
|
|
21415
21693
|
context.displayName = 'Grep.ToC.Context';
|
|
21416
21694
|
|
|
21417
|
-
|
|
21418
|
-
.map((_, i) => `h${i + 1}:not([role="presentation"])`)
|
|
21695
|
+
var defaultSelector = __spreadArray([], __read(new Array(9)), false).map(function (_, i) { return "h".concat(i + 1, ":not([role=\"presentation\"])"); })
|
|
21419
21696
|
.join(',');
|
|
21420
|
-
|
|
21421
|
-
|
|
21422
|
-
|
|
21423
|
-
|
|
21424
|
-
|
|
21425
|
-
|
|
21426
|
-
|
|
21427
|
-
|
|
21428
|
-
|
|
21429
|
-
|
|
21430
|
-
|
|
21697
|
+
var GrepTableOfContentProvider = function (_a) {
|
|
21698
|
+
var props = __rest$1(_a, []);
|
|
21699
|
+
var container = props.container, identifier = props.identifier, onSelected = props.onSelected, classes = props.classes, scrollTarget = props.scrollTarget, children = props.children, _b = props.offsetTop, offsetTop = _b === void 0 ? -10 : _b, _c = props.identifyElementFn, identifyElementFn = _c === void 0 ? identifyElement : _c;
|
|
21700
|
+
var _d = __read(useState(), 2), selected = _d[0], _setSelected = _d[1];
|
|
21701
|
+
var _e = __read(useState(), 2), initialized = _e[0], setInitialized = _e[1];
|
|
21702
|
+
var hash = useSelector(function (s) { return decodeURI(getHash(s)); }).substring(1);
|
|
21703
|
+
var scrollToElement = useCallback$1(function (element) {
|
|
21704
|
+
var target = scrollTarget || window;
|
|
21705
|
+
var elementBounds = element.getBoundingClientRect();
|
|
21706
|
+
var elementTop = elementBounds.top - element.clientHeight;
|
|
21707
|
+
var top = elementTop - offsetTop;
|
|
21708
|
+
target.scrollBy({ top: top });
|
|
21431
21709
|
}, [scrollTarget, offsetTop]);
|
|
21432
|
-
|
|
21710
|
+
var identify = useMemo$1(function () {
|
|
21433
21711
|
return identifyElementFn(identifier || generateElementId);
|
|
21434
21712
|
}, [identifier, identifyElementFn]);
|
|
21435
|
-
|
|
21436
|
-
|
|
21713
|
+
var elements = useContentElements(container, props.selector || defaultSelector, { identify: identify });
|
|
21714
|
+
var setSelected = useCallback$1(lodash_throttle(function (element, scroll) {
|
|
21437
21715
|
element && scroll && scrollToElement(element);
|
|
21438
21716
|
_setSelected(element);
|
|
21439
21717
|
}, 50, { trailing: false }), [_setSelected, scrollToElement]);
|
|
21440
|
-
|
|
21441
|
-
|
|
21718
|
+
var getViewportElement = useCallback$1(function () {
|
|
21719
|
+
var records = Object.values(elements);
|
|
21442
21720
|
if (!records.length)
|
|
21443
21721
|
return;
|
|
21444
|
-
|
|
21722
|
+
var index = records.findIndex(function (e) { return e.getBoundingClientRect().bottom > offsetTop; });
|
|
21445
21723
|
if (index > 0) {
|
|
21446
|
-
|
|
21447
|
-
|
|
21448
|
-
|
|
21724
|
+
var rect = records[index].getBoundingClientRect();
|
|
21725
|
+
var offset = Math.floor(rect.top - offsetTop);
|
|
21726
|
+
var within = offset < rect.height + 20;
|
|
21449
21727
|
return records[within ? index : index - 1];
|
|
21450
21728
|
}
|
|
21451
21729
|
return records[index];
|
|
21452
21730
|
}, [elements, offsetTop]);
|
|
21453
21731
|
// attach observer to elements
|
|
21454
|
-
useEffect(()
|
|
21455
|
-
|
|
21732
|
+
useEffect(function () {
|
|
21733
|
+
var target = scrollTarget || window;
|
|
21456
21734
|
if (!target)
|
|
21457
21735
|
return;
|
|
21458
|
-
|
|
21459
|
-
|
|
21736
|
+
var onScroll = lodash_throttle(function () {
|
|
21737
|
+
var element = getViewportElement();
|
|
21460
21738
|
setSelected(element);
|
|
21461
21739
|
}, 50);
|
|
21462
21740
|
target.addEventListener('scroll', onScroll, false);
|
|
21463
21741
|
console.debug('scroll observer attached');
|
|
21464
|
-
return ()
|
|
21742
|
+
return function () {
|
|
21465
21743
|
console.debug('scroll observer detached');
|
|
21466
21744
|
return target.removeEventListener('scroll', onScroll);
|
|
21467
21745
|
};
|
|
21468
21746
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
21469
21747
|
// notify observer when selected change
|
|
21470
|
-
useEffect(()
|
|
21748
|
+
useEffect(function () {
|
|
21471
21749
|
selected && onSelected && onSelected(selected);
|
|
21472
21750
|
}, [selected, onSelected]);
|
|
21473
21751
|
// observe changes in hash
|
|
21474
|
-
useEffect(()
|
|
21752
|
+
useEffect(function () {
|
|
21475
21753
|
if (hash && elements[hash]) {
|
|
21476
21754
|
console.debug('anchor change, setting selected element');
|
|
21477
21755
|
setSelected(elements[hash], true);
|
|
@@ -21483,15 +21761,17 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
21483
21761
|
setSelected(elements[hash], true);
|
|
21484
21762
|
setInitialized(true);
|
|
21485
21763
|
}
|
|
21486
|
-
return (React__default.createElement(context.Provider, { value: { elements, selected, classes, setSelected } }, children));
|
|
21764
|
+
return (React__default.createElement(context.Provider, { value: { elements: elements, selected: selected, classes: classes, setSelected: setSelected } }, children));
|
|
21487
21765
|
};
|
|
21488
21766
|
GrepTableOfContentProvider.displayName = 'Grep.ToC.Provider';
|
|
21489
21767
|
|
|
21490
|
-
|
|
21491
|
-
|
|
21492
|
-
|
|
21493
|
-
|
|
21494
|
-
|
|
21768
|
+
var useStyles$2 = makeStyles()(function (_a, _b) {
|
|
21769
|
+
var palette = _a.palette;
|
|
21770
|
+
var lvl = _b.lvl;
|
|
21771
|
+
var defaultColor = convertToRgba(palette.primary.main, 0.75);
|
|
21772
|
+
var linkcolor = "var(--grep-toc-link-color, ".concat(defaultColor, ")");
|
|
21773
|
+
var selectedColor = "var(--grep-toc-selected-color, ".concat(palette.primary.main, ")");
|
|
21774
|
+
var focusBackground = "var(--grep-toc-focused-background, ".concat(convertToRgba(palette.primary.main, 0.1), ")");
|
|
21495
21775
|
return {
|
|
21496
21776
|
root: {
|
|
21497
21777
|
color: linkcolor,
|
|
@@ -21507,7 +21787,7 @@ const useStyles$2 = makeStyles()(({ palette }, { lvl }) => {
|
|
|
21507
21787
|
textOverflow: 'ellipsis',
|
|
21508
21788
|
'&--selected': {
|
|
21509
21789
|
color: selectedColor,
|
|
21510
|
-
borderLeft:
|
|
21790
|
+
borderLeft: "5px solid ".concat(selectedColor),
|
|
21511
21791
|
},
|
|
21512
21792
|
'&:focus': {
|
|
21513
21793
|
outline: 'none',
|
|
@@ -21517,47 +21797,48 @@ const useStyles$2 = makeStyles()(({ palette }, { lvl }) => {
|
|
|
21517
21797
|
};
|
|
21518
21798
|
});
|
|
21519
21799
|
|
|
21520
|
-
|
|
21521
|
-
|
|
21522
|
-
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21526
|
-
|
|
21527
|
-
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
|
-
|
|
21531
|
-
|
|
21532
|
-
useEffect(()
|
|
21533
|
-
|
|
21800
|
+
var GrepTableOfContentNavTreeNode = function (props) {
|
|
21801
|
+
var linkRef = useRef(null);
|
|
21802
|
+
var node = props.node, style = props.style, renderChilds = props.renderChilds, setSelectedValue = props.setSelectedValue, percentageRendered = props.percentageRendered;
|
|
21803
|
+
var lvl = node.lvl, el = node.el, index = node.index, children = node.children;
|
|
21804
|
+
var _a = useContext(context), selected = _a.selected, setSelected = _a.setSelected, classes = _a.classes, elements = _a.elements;
|
|
21805
|
+
var isSelected = el === selected;
|
|
21806
|
+
var styles = useStyles$2({ lvl: lvl }).classes;
|
|
21807
|
+
var className = clsx('grep-toc__nav-tree-node', isSelected && 'grep-toc__nav-tree-node--selected', styles.root, classes === null || classes === void 0 ? void 0 : classes.node, props.className);
|
|
21808
|
+
var _b = __read(useState(false), 2), awaitingRender = _b[0], setAwaitingRender = _b[1];
|
|
21809
|
+
var txt = el.innerText;
|
|
21810
|
+
var location = useSelector(function (s) { return getLocation(s); });
|
|
21811
|
+
var url = "".concat(location.pathname).concat(location.search, "#").concat(node.id);
|
|
21812
|
+
useEffect(function () {
|
|
21813
|
+
var link = linkRef.current;
|
|
21534
21814
|
if (isSelected) {
|
|
21535
|
-
link
|
|
21815
|
+
link === null || link === void 0 ? void 0 : link.scrollIntoViewIfNeeded();
|
|
21536
21816
|
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
21537
21817
|
}
|
|
21538
21818
|
else if (link === document.activeElement) {
|
|
21539
|
-
link
|
|
21819
|
+
link === null || link === void 0 ? void 0 : link.blur();
|
|
21540
21820
|
}
|
|
21541
21821
|
}, [isSelected, linkRef, setSelectedValue]);
|
|
21542
|
-
|
|
21543
|
-
useEffect(()
|
|
21822
|
+
var tabIndex = isSelected ? 0 : -1;
|
|
21823
|
+
useEffect(function () {
|
|
21544
21824
|
if (awaitingRender) {
|
|
21545
21825
|
doSelect();
|
|
21546
21826
|
setAwaitingRender(false);
|
|
21547
21827
|
}
|
|
21548
21828
|
}, [percentageRendered]);
|
|
21549
|
-
|
|
21829
|
+
var doSelect = function (checkAwaitRender) {
|
|
21830
|
+
if (checkAwaitRender === void 0) { checkAwaitRender = false; }
|
|
21550
21831
|
window.history.replaceState({}, txt, url);
|
|
21551
21832
|
setSelected(el, true);
|
|
21552
|
-
|
|
21553
|
-
|
|
21833
|
+
var values = Object.values(elements);
|
|
21834
|
+
var newPercentage = values.findIndex(function (e) { return e === el; }) / values.length + 0.1;
|
|
21554
21835
|
setSelectedValue(newPercentage);
|
|
21555
21836
|
if (checkAwaitRender && newPercentage > percentageRendered) {
|
|
21556
21837
|
setAwaitingRender(true);
|
|
21557
21838
|
}
|
|
21558
21839
|
};
|
|
21559
21840
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
21560
|
-
React__default.createElement(Link$1, { ref: linkRef, className: clsx(styles.link, isSelected &&
|
|
21841
|
+
React__default.createElement(Link$1, { ref: linkRef, className: clsx(styles.link, isSelected && "".concat(styles.link, "--selected")), href: url, tabIndex: tabIndex, onClick: function (event) {
|
|
21561
21842
|
console.debug('node click', node);
|
|
21562
21843
|
event.preventDefault();
|
|
21563
21844
|
event.stopPropagation();
|
|
@@ -21567,7 +21848,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
21567
21848
|
};
|
|
21568
21849
|
GrepTableOfContentNavTreeNode.displayName = 'Grep.ToC.NavTree.Node';
|
|
21569
21850
|
|
|
21570
|
-
|
|
21851
|
+
var useStyles$1 = makeStyles()(function () { return ({
|
|
21571
21852
|
root: {
|
|
21572
21853
|
listStyle: 'none',
|
|
21573
21854
|
padding: 0,
|
|
@@ -21575,18 +21856,18 @@ const useStyles$1 = makeStyles()(() => ({
|
|
|
21575
21856
|
fontSize: '.9em',
|
|
21576
21857
|
},
|
|
21577
21858
|
},
|
|
21578
|
-
}));
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
return (React__default.createElement("ul", { className: className, style: style }, Object.values(elements).map((node)
|
|
21859
|
+
}); });
|
|
21860
|
+
|
|
21861
|
+
var NavTree = function (props) {
|
|
21862
|
+
var elements = props.elements, style = props.style, setSelectedValue = props.setSelectedValue, percentageRendered = props.percentageRendered;
|
|
21863
|
+
var classes = useContext(context).classes;
|
|
21864
|
+
var styles = useStyles$1().classes;
|
|
21865
|
+
var className = clsx('grep-toc__nav-tree', styles.root, classes === null || classes === void 0 ? void 0 : classes.tree, props.className);
|
|
21866
|
+
return (React__default.createElement("ul", { className: className, style: style }, Object.values(elements).map(function (node) { return (React__default.createElement(GrepTableOfContentNavTreeNode, { node: node, key: node.index, renderChilds: function (children) { return (React__default.createElement(NavTree, { elements: children, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })); }, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })); })));
|
|
21586
21867
|
};
|
|
21587
21868
|
NavTree.displayName = 'Grep.ToC.NavTree';
|
|
21588
21869
|
|
|
21589
|
-
|
|
21870
|
+
var useStyles = makeStyles()(function () { return ({
|
|
21590
21871
|
root: {
|
|
21591
21872
|
fontSize: 18,
|
|
21592
21873
|
overflowY: 'scroll',
|
|
@@ -21609,47 +21890,54 @@ const useStyles = makeStyles()(() => ({
|
|
|
21609
21890
|
padding: '2px 5px',
|
|
21610
21891
|
},
|
|
21611
21892
|
},
|
|
21612
|
-
}));
|
|
21893
|
+
}); });
|
|
21613
21894
|
|
|
21614
|
-
|
|
21615
|
-
|
|
21895
|
+
var getElementLevel = function (el) {
|
|
21896
|
+
var res = el.nodeName.match(/H([1-9])/);
|
|
21616
21897
|
if (res) {
|
|
21617
|
-
|
|
21898
|
+
var _a = __read(res, 2); _a[0]; var lvl = _a[1];
|
|
21618
21899
|
return Number(lvl);
|
|
21619
21900
|
}
|
|
21620
21901
|
return 0;
|
|
21621
21902
|
};
|
|
21622
21903
|
|
|
21623
|
-
|
|
21624
|
-
return elements.reduce((curr, el, index)
|
|
21625
|
-
|
|
21626
|
-
|
|
21627
|
-
|
|
21628
|
-
curr.
|
|
21904
|
+
var normalize = function (elements) {
|
|
21905
|
+
return elements.reduce(function (curr, el, index) {
|
|
21906
|
+
var _a;
|
|
21907
|
+
var id = el.id;
|
|
21908
|
+
var lvl = getElementLevel(el, elements[index - 1]);
|
|
21909
|
+
var parent = (_a = __spreadArray([], __read(curr), false).reverse().find(function (obj) { return obj.lvl < lvl; })) === null || _a === void 0 ? void 0 : _a.index;
|
|
21910
|
+
curr.push({ id: id, el: el, lvl: lvl, parent: parent, index: index });
|
|
21629
21911
|
return curr;
|
|
21630
21912
|
}, []);
|
|
21631
21913
|
};
|
|
21632
21914
|
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
|
|
21639
|
-
|
|
21915
|
+
var nest = function (items, id) {
|
|
21916
|
+
return items
|
|
21917
|
+
.filter(function (item) { return item.parent === id; })
|
|
21918
|
+
.reduce(function (curr, item) {
|
|
21919
|
+
var _a;
|
|
21920
|
+
return Object.assign(curr, (_a = {},
|
|
21921
|
+
_a[item.index] = __assign(__assign({}, item), { children: nest(items, item.index) }),
|
|
21922
|
+
_a));
|
|
21923
|
+
}, {});
|
|
21924
|
+
};
|
|
21925
|
+
var buildTree = function (elements, normalizer) {
|
|
21926
|
+
if (normalizer === void 0) { normalizer = normalize; }
|
|
21927
|
+
var items = normalizer(elements);
|
|
21640
21928
|
return nest(items);
|
|
21641
21929
|
};
|
|
21642
21930
|
|
|
21643
|
-
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
|
|
21649
|
-
requestAnimationFrame(()
|
|
21931
|
+
var GrepTableOfContentNav = function (props) {
|
|
21932
|
+
var _a = __read(useState(false), 2), showKeyboardHint = _a[0], setShowKeyboardHint = _a[1];
|
|
21933
|
+
var ref = useRef(null);
|
|
21934
|
+
var _b = useContext(context), elements = _b.elements, classes = _b.classes, selected = _b.selected, setSelected = _b.setSelected;
|
|
21935
|
+
var tree = useMemo$1(function () { return buildTree(Object.values(elements)); }, [elements]);
|
|
21936
|
+
var focusSelected = useCallback$1(function () {
|
|
21937
|
+
requestAnimationFrame(function () {
|
|
21650
21938
|
if (!(ref.current instanceof HTMLElement))
|
|
21651
21939
|
return;
|
|
21652
|
-
|
|
21940
|
+
var active = ref.current.querySelector('[tabindex="0"]');
|
|
21653
21941
|
if (active instanceof HTMLElement) {
|
|
21654
21942
|
active.focus();
|
|
21655
21943
|
}
|
|
@@ -21658,54 +21946,55 @@ const GrepTableOfContentNav = (props) => {
|
|
|
21658
21946
|
}
|
|
21659
21947
|
});
|
|
21660
21948
|
}, [ref]);
|
|
21661
|
-
|
|
21949
|
+
var onKeyDown = function (e) {
|
|
21662
21950
|
if (selected && e.which === Key_enum.Key.Tab && e.shiftKey === false) {
|
|
21663
|
-
|
|
21951
|
+
var tabindex_1 = selected.getAttribute('tabindex');
|
|
21664
21952
|
selected.setAttribute('tabindex', '0');
|
|
21665
21953
|
selected.focus();
|
|
21666
|
-
requestAnimationFrame(()
|
|
21667
|
-
|
|
21954
|
+
requestAnimationFrame(function () {
|
|
21955
|
+
tabindex_1 === null
|
|
21668
21956
|
? selected.removeAttribute('tabindex')
|
|
21669
|
-
: selected.setAttribute('tabindex',
|
|
21957
|
+
: selected.setAttribute('tabindex', tabindex_1);
|
|
21670
21958
|
});
|
|
21671
21959
|
}
|
|
21672
21960
|
if ([Key_enum.Key.UpArrow, Key_enum.Key.DownArrow].includes(e.which)) {
|
|
21673
21961
|
e.preventDefault();
|
|
21674
21962
|
e.stopPropagation();
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21963
|
+
var nodes = Object.values(elements);
|
|
21964
|
+
var currentIndex = nodes.indexOf(selected);
|
|
21965
|
+
var moveIndex = e.which === Key_enum.Key.UpArrow ? -1 : 1;
|
|
21966
|
+
var next = nodes[currentIndex + moveIndex];
|
|
21679
21967
|
next && setSelected(next, true);
|
|
21680
21968
|
focusSelected();
|
|
21681
21969
|
}
|
|
21682
21970
|
};
|
|
21683
|
-
useEffect(()
|
|
21684
|
-
|
|
21971
|
+
useEffect(function () {
|
|
21972
|
+
var onKeyDown = function (e) {
|
|
21685
21973
|
e.keyCode === Key_enum.Key.Alt && setShowKeyboardHint(true);
|
|
21686
21974
|
if (e.altKey) {
|
|
21687
21975
|
e.keyCode === Key_enum.Key.I && focusSelected();
|
|
21688
21976
|
}
|
|
21689
21977
|
};
|
|
21690
|
-
|
|
21978
|
+
var onKeyUp = function (e) {
|
|
21691
21979
|
e.keyCode === Key_enum.Key.Alt && setShowKeyboardHint(false);
|
|
21692
21980
|
};
|
|
21693
21981
|
window.addEventListener('keydown', onKeyDown);
|
|
21694
21982
|
window.addEventListener('keyup', onKeyUp);
|
|
21695
|
-
return ()
|
|
21983
|
+
return function () {
|
|
21696
21984
|
window.removeEventListener('keydown', onKeyDown);
|
|
21697
21985
|
window.removeEventListener('keyup', onKeyUp);
|
|
21698
21986
|
};
|
|
21699
21987
|
}, [focusSelected]);
|
|
21700
|
-
|
|
21701
|
-
|
|
21988
|
+
var style = useStyles().classes;
|
|
21989
|
+
var className = clsx('grep-toc__nav', style.root, classes === null || classes === void 0 ? void 0 : classes.nav, props.className, showKeyboardHint && style.keyboardHint);
|
|
21702
21990
|
return (React__default.createElement("nav", { className: className, style: props.style, tabIndex: selected ? -1 : 0, onKeyDown: onKeyDown, ref: ref },
|
|
21703
21991
|
React__default.createElement(NavTree, { elements: tree, setSelectedValue: props.setSelectedValue, percentageRendered: props.percentageRendered })));
|
|
21704
21992
|
};
|
|
21705
21993
|
GrepTableOfContentNav.displayName = 'Grep.ToC.Nav';
|
|
21706
21994
|
|
|
21707
|
-
|
|
21708
|
-
|
|
21995
|
+
var GrepTableOfContent = function (_a) {
|
|
21996
|
+
var style = _a.style, className = _a.className, setSelectedValue = _a.setSelectedValue, percentageRendered = _a.percentageRendered, props = __rest$1(_a, ["style", "className", "setSelectedValue", "percentageRendered"]);
|
|
21997
|
+
return (React__default.createElement(GrepTableOfContentProvider, __assign({}, props),
|
|
21709
21998
|
React__default.createElement(GrepTableOfContentNav, { className: className, style: style, setSelectedValue: setSelectedValue, percentageRendered: percentageRendered })));
|
|
21710
21999
|
};
|
|
21711
22000
|
GrepTableOfContent.displayName = 'Grep.ToC';
|