@pie-element/multi-trait-rubric 0.1.0
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/author/common.d.ts +91 -0
- package/dist/author/common.d.ts.map +1 -0
- package/dist/author/common.js +275 -0
- package/dist/author/defaults.d.ts +154 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +113 -0
- package/dist/author/index.d.ts +23 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +89 -0
- package/dist/author/main.d.ts +44 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +249 -0
- package/dist/author/modals.d.ts +95 -0
- package/dist/author/modals.d.ts.map +1 -0
- package/dist/author/modals.js +171 -0
- package/dist/author/scale.d.ts +47 -0
- package/dist/author/scale.d.ts.map +1 -0
- package/dist/author/scale.js +280 -0
- package/dist/author/trait.d.ts +71 -0
- package/dist/author/trait.d.ts.map +1 -0
- package/dist/author/trait.js +202 -0
- package/dist/author/traitsHeader.d.ts +29 -0
- package/dist/author/traitsHeader.d.ts.map +1 -0
- package/dist/author/traitsHeader.js +172 -0
- package/dist/author/utils.d.ts +11 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +41 -0
- package/dist/controller/defaults.d.ts +21 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +14 -0
- package/dist/controller/index.d.ts +27 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +57 -0
- package/dist/controller/utils.d.ts +10 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +4 -0
- package/dist/delivery/index.d.ts +18 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +37 -0
- package/dist/delivery/main.d.ts +16 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +95 -0
- package/dist/delivery/scale.d.ts +18 -0
- package/dist/delivery/scale.d.ts.map +1 -0
- package/dist/delivery/scale.js +175 -0
- package/dist/delivery/trait.d.ts +28 -0
- package/dist/delivery/trait.d.ts.map +1 -0
- package/dist/delivery/trait.js +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +145 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +50 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
- package/package.json +70 -0
- package/src/author/common.tsx +473 -0
- package/src/author/defaults.tsx +157 -0
- package/src/author/index.ts +174 -0
- package/src/author/main.tsx +407 -0
- package/src/author/modals.tsx +254 -0
- package/src/author/scale.tsx +453 -0
- package/src/author/trait.tsx +305 -0
- package/src/author/traitsHeader.tsx +301 -0
- package/src/author/utils.ts +83 -0
- package/src/controller/defaults.ts +21 -0
- package/src/controller/index.ts +137 -0
- package/src/controller/utils.ts +13 -0
- package/src/delivery/index.ts +61 -0
- package/src/delivery/main.tsx +140 -0
- package/src/delivery/scale.tsx +313 -0
- package/src/delivery/trait.tsx +86 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/multi-trait-rubric/configure/src/main.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
|
|
14
|
+
import { cloneDeep, debounce, isEmpty } from 'lodash-es';
|
|
15
|
+
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
|
|
18
|
+
import { layout, settings } from '@pie-lib/config-ui';
|
|
19
|
+
|
|
20
|
+
import Scale from './scale.js';
|
|
21
|
+
import { MultiTraitButton } from './common.js';
|
|
22
|
+
import { ExcludeZeroDialog, excludeZeroTypes, IncludeZeroDialog, InfoDialog } from './modals.js';
|
|
23
|
+
import { addOrRemoveScaleColumn } from './utils.js';
|
|
24
|
+
|
|
25
|
+
const { Panel, toggle } = settings;
|
|
26
|
+
const MIN_WIDTH = '650px';
|
|
27
|
+
|
|
28
|
+
const StyledDiv: any = styled('div')(({ theme }) => ({
|
|
29
|
+
fontFamily: 'Cerebri Sans',
|
|
30
|
+
fontSize: theme.typography.fontSize + 2, // current font size is 14px, so this will make it 16px
|
|
31
|
+
padding: '16px 0',
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const ShowModal = ({ showExcludeZeroDialog, excludeZero, changeExcludeZero, cancel }) => {
|
|
35
|
+
if (showExcludeZeroDialog && !excludeZero) {
|
|
36
|
+
return (
|
|
37
|
+
<ExcludeZeroDialog
|
|
38
|
+
open={showExcludeZeroDialog && !excludeZero}
|
|
39
|
+
changeExcludeZero={changeExcludeZero}
|
|
40
|
+
cancel={cancel}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
} else if (showExcludeZeroDialog && excludeZero) {
|
|
44
|
+
return (
|
|
45
|
+
<IncludeZeroDialog
|
|
46
|
+
open={showExcludeZeroDialog && excludeZero}
|
|
47
|
+
changeExcludeZero={changeExcludeZero}
|
|
48
|
+
cancel={cancel}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
ShowModal.propTypes = {
|
|
57
|
+
showExcludeZeroDialog: PropTypes.bool,
|
|
58
|
+
excludeZero: PropTypes.bool,
|
|
59
|
+
changeExcludeZero: PropTypes.func,
|
|
60
|
+
cancel: PropTypes.func,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export class Main extends React.Component {
|
|
64
|
+
constructor(props) {
|
|
65
|
+
super(props);
|
|
66
|
+
this.divRef = React.createRef();
|
|
67
|
+
this.updateDivWidth = this.updateDivWidth.bind(this);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
state = {
|
|
71
|
+
showDecreaseMaxPointsDialog: false,
|
|
72
|
+
showDeleteScaleDialog: false,
|
|
73
|
+
showDeleteTraitDialog: false,
|
|
74
|
+
showExcludeZeroDialog: false,
|
|
75
|
+
showInfoDialog: false,
|
|
76
|
+
infoDialogText: '',
|
|
77
|
+
adjustedWidth: MIN_WIDTH,
|
|
78
|
+
initialUpdateCompleted: false, // flag to track the initial update of the div width
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
componentDidMount() {
|
|
82
|
+
window.addEventListener('resize', this.updateDivWidthDebounced);
|
|
83
|
+
window.addEventListener('load', this.updateDivWidth);
|
|
84
|
+
|
|
85
|
+
// delay updateDivWidth to avoid having this.divRef.current = null at first load
|
|
86
|
+
setTimeout(this.updateDivWidth, 0);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
componentWillUnmount() {
|
|
90
|
+
window.removeEventListener('resize', this.updateDivWidthDebounced);
|
|
91
|
+
window.removeEventListener('load', this.updateDivWidth);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
componentDidUpdate() {
|
|
95
|
+
if (!this.state.initialUpdateCompleted) {
|
|
96
|
+
this.updateDivWidth();
|
|
97
|
+
this.setState({ initialUpdateCompleted: true });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
updateDivWidth() {
|
|
102
|
+
if (this.divRef && this.divRef.current) {
|
|
103
|
+
const divWidth = this.divRef.current.offsetWidth;
|
|
104
|
+
if (divWidth !== this.state.adjustedWidth) {
|
|
105
|
+
this.set({
|
|
106
|
+
adjustedWidth: divWidth,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
updateDivWidthDebounced = debounce(() => this.updateDivWidth(), 50);
|
|
113
|
+
|
|
114
|
+
onScaleAdded: any = () => {
|
|
115
|
+
const { model, onModelChanged, configuration } = this.props;
|
|
116
|
+
let { scales, excludeZero } = model || {};
|
|
117
|
+
const { maxNoOfScales } = configuration || {};
|
|
118
|
+
let { defaultTraitLabel } = configuration || '';
|
|
119
|
+
|
|
120
|
+
if (!scales.length) {
|
|
121
|
+
scales = [];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// if no default trait label is defined, take the trait label of the first scale
|
|
125
|
+
defaultTraitLabel = typeof defaultTraitLabel === 'string' ? defaultTraitLabel : scales[0]?.traitLabel || '';
|
|
126
|
+
|
|
127
|
+
if (scales.length === maxNoOfScales) {
|
|
128
|
+
this.set({
|
|
129
|
+
infoDialogText: `There can't be more than ${maxNoOfScales} scales.`,
|
|
130
|
+
showInfoDialog: true,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
scales.push({
|
|
137
|
+
maxPoints: 1,
|
|
138
|
+
scorePointsLabels: excludeZero ? [''] : ['', ''],
|
|
139
|
+
traitLabel: defaultTraitLabel,
|
|
140
|
+
traits: [],
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
onModelChanged({ ...model, scales });
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
onScaleChanged: any = (scaleIndex, params) => {
|
|
147
|
+
const { model, onModelChanged } = this.props;
|
|
148
|
+
let scales = cloneDeep((model || {}).scales);
|
|
149
|
+
|
|
150
|
+
if (scaleIndex < 0 || scaleIndex >= scales.length || isEmpty(params)) return false;
|
|
151
|
+
|
|
152
|
+
Object.keys(params).forEach((key) => {
|
|
153
|
+
scales[scaleIndex][key] = params[key];
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
if (model.excludeZero && params.maxPoints === 1) {
|
|
157
|
+
// excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
158
|
+
model.excludeZero = false;
|
|
159
|
+
scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
onModelChanged({ ...model, scales });
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
onScaleRemoved: any = (scaleIndex) => {
|
|
166
|
+
const { model, onModelChanged, configuration } = this.props;
|
|
167
|
+
let { scales } = model || {};
|
|
168
|
+
const { minNoOfScales } = configuration || {};
|
|
169
|
+
|
|
170
|
+
if (scaleIndex < 0 || scaleIndex >= scales.length) return false;
|
|
171
|
+
|
|
172
|
+
if (scales.length === minNoOfScales) {
|
|
173
|
+
this.set({
|
|
174
|
+
infoDialogText: `There can't be less than ${minNoOfScales} scales.`,
|
|
175
|
+
showInfoDialog: true,
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
scales = [...scales.slice(0, scaleIndex), ...scales.slice(scaleIndex + 1)];
|
|
182
|
+
|
|
183
|
+
onModelChanged({ ...model, scales });
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
onHalfScoringChanged: any = () => {
|
|
187
|
+
const { model, onModelChanged } = this.props;
|
|
188
|
+
let { halfScoring } = model || {};
|
|
189
|
+
|
|
190
|
+
onModelChanged({ ...model, halfScoring: !halfScoring });
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
onVisibleToStudentChanged: any = () => {
|
|
194
|
+
const { model, onModelChanged } = this.props;
|
|
195
|
+
let { visibleToStudent } = model || {};
|
|
196
|
+
|
|
197
|
+
onModelChanged({ ...model, visibleToStudent: !visibleToStudent });
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
set = (newState) => this.setState(newState);
|
|
201
|
+
|
|
202
|
+
changeShowScorePointLabels: any = () => {
|
|
203
|
+
const { model, onModelChanged } = this.props || {};
|
|
204
|
+
let { pointLabels } = model || {};
|
|
205
|
+
|
|
206
|
+
pointLabels = !pointLabels;
|
|
207
|
+
|
|
208
|
+
onModelChanged({ ...model, pointLabels });
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
changeShowDescription: any = () => {
|
|
212
|
+
const { model, onModelChanged } = this.props || {};
|
|
213
|
+
let { description } = model || {};
|
|
214
|
+
|
|
215
|
+
description = !description;
|
|
216
|
+
|
|
217
|
+
onModelChanged({ ...model, description });
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
changeShowStandards: any = () => {
|
|
221
|
+
const { model, onModelChanged } = this.props || {};
|
|
222
|
+
let { standards } = model || {};
|
|
223
|
+
|
|
224
|
+
standards = !standards;
|
|
225
|
+
|
|
226
|
+
onModelChanged({ ...model, standards });
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// Exclude Zero
|
|
230
|
+
showToggleExcludeZeroModal = () => this.set({ showExcludeZeroDialog: true });
|
|
231
|
+
|
|
232
|
+
hideToggleExcludeZeroModal: any = () => {
|
|
233
|
+
this.set({ showExcludeZeroDialog: false });
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
onCloseInfoDialog = () => this.set({ showInfoDialog: false });
|
|
237
|
+
|
|
238
|
+
changeExcludeZero: any = (excludeZeroType) => {
|
|
239
|
+
const { model, onModelChanged } = this.props || {};
|
|
240
|
+
const { scales } = model || {};
|
|
241
|
+
let { excludeZero } = model || {};
|
|
242
|
+
|
|
243
|
+
if (!scales || !scales.length) return;
|
|
244
|
+
|
|
245
|
+
excludeZero = !excludeZero;
|
|
246
|
+
const newScales = addOrRemoveScaleColumn(scales, excludeZeroType);
|
|
247
|
+
|
|
248
|
+
onModelChanged({ ...model, scales: newScales, excludeZero });
|
|
249
|
+
|
|
250
|
+
this.hideToggleExcludeZeroModal();
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
onModelChanged: any = (updatedModel, updatedProperty) => {
|
|
254
|
+
const { onModelChanged } = this.props || {};
|
|
255
|
+
|
|
256
|
+
if (updatedProperty === 'excludeZero') {
|
|
257
|
+
this.showToggleExcludeZeroModal();
|
|
258
|
+
} else {
|
|
259
|
+
onModelChanged(updatedModel);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
render() {
|
|
264
|
+
const { model, configuration, onConfigurationChanged, uploadSoundSupport, imageSupport } = this.props || {};
|
|
265
|
+
const {
|
|
266
|
+
addScale,
|
|
267
|
+
baseInputConfiguration = {},
|
|
268
|
+
dragAndDrop,
|
|
269
|
+
contentDimensions = {},
|
|
270
|
+
showDescription,
|
|
271
|
+
showExcludeZero,
|
|
272
|
+
showLevelTagInput,
|
|
273
|
+
showStandards,
|
|
274
|
+
showHalfScoring,
|
|
275
|
+
showMaxPoint,
|
|
276
|
+
showScorePointLabels,
|
|
277
|
+
showVisibleToStudent,
|
|
278
|
+
spellCheck = {},
|
|
279
|
+
settingsPanelDisabled,
|
|
280
|
+
maxNoOfTraits,
|
|
281
|
+
minNoOfTraits,
|
|
282
|
+
width,
|
|
283
|
+
mathMlOptions = {},
|
|
284
|
+
maxMaxPoints,
|
|
285
|
+
expandedInput = {},
|
|
286
|
+
labelInput = {},
|
|
287
|
+
} = configuration || {};
|
|
288
|
+
const {
|
|
289
|
+
errors,
|
|
290
|
+
extraCSSRules,
|
|
291
|
+
scales,
|
|
292
|
+
excludeZero,
|
|
293
|
+
description,
|
|
294
|
+
pointLabels,
|
|
295
|
+
standards,
|
|
296
|
+
spellCheckEnabled,
|
|
297
|
+
maxPointsEnabled,
|
|
298
|
+
addScaleEnabled,
|
|
299
|
+
} = model || {};
|
|
300
|
+
const { showExcludeZeroDialog, showInfoDialog, infoDialogText, adjustedWidth } = this.state || {};
|
|
301
|
+
|
|
302
|
+
// excludeZero should be false and disabled when maxPoints is 1 for any scale
|
|
303
|
+
const disabledExcludeZero = scales?.some((scale) => scale.maxPoints === 1);
|
|
304
|
+
|
|
305
|
+
const panelSettings = {
|
|
306
|
+
standards: showStandards.settings && toggle(showStandards.label),
|
|
307
|
+
'showLevelTagInput.enabled': showLevelTagInput.settings && toggle(showLevelTagInput.label, true),
|
|
308
|
+
visibleToStudent: showVisibleToStudent.settings && toggle(showVisibleToStudent.label),
|
|
309
|
+
excludeZero: showExcludeZero.settings && toggle(showExcludeZero.label, false, disabledExcludeZero),
|
|
310
|
+
halfScoring: showHalfScoring.settings && toggle(showHalfScoring.label),
|
|
311
|
+
'dragAndDrop.enabled': dragAndDrop.settings && toggle(dragAndDrop.label, true),
|
|
312
|
+
};
|
|
313
|
+
const panelProperties = {
|
|
314
|
+
description: showDescription.settings && toggle(showDescription.label),
|
|
315
|
+
pointLabels: showScorePointLabels.settings && toggle(showScorePointLabels.label),
|
|
316
|
+
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
317
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
318
|
+
addScaleEnabled: addScale.settings && toggle(addScale.label),
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const getPluginProps = (props) => {
|
|
322
|
+
return Object.assign(
|
|
323
|
+
{
|
|
324
|
+
...baseInputConfiguration,
|
|
325
|
+
},
|
|
326
|
+
props || {},
|
|
327
|
+
);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<layout.ConfigLayout
|
|
332
|
+
extraCSSRules={extraCSSRules}
|
|
333
|
+
dimensions={contentDimensions}
|
|
334
|
+
hideSettings={settingsPanelDisabled}
|
|
335
|
+
settings={
|
|
336
|
+
<Panel
|
|
337
|
+
model={model}
|
|
338
|
+
onChangeModel={this.onModelChanged}
|
|
339
|
+
configuration={configuration}
|
|
340
|
+
onChangeConfiguration={onConfigurationChanged}
|
|
341
|
+
groups={{
|
|
342
|
+
Settings: panelSettings,
|
|
343
|
+
Properties: panelProperties,
|
|
344
|
+
}}
|
|
345
|
+
modal={
|
|
346
|
+
<ShowModal
|
|
347
|
+
showExcludeZeroDialog={showExcludeZeroDialog}
|
|
348
|
+
excludeZero={excludeZero}
|
|
349
|
+
changeExcludeZero={this.changeExcludeZero}
|
|
350
|
+
cancel={this.hideToggleExcludeZeroModal}
|
|
351
|
+
></ShowModal>
|
|
352
|
+
}
|
|
353
|
+
/>
|
|
354
|
+
}
|
|
355
|
+
>
|
|
356
|
+
<div style={{ width: '100%' }} ref={this.divRef} />
|
|
357
|
+
<StyledDiv style={{ width: width || adjustedWidth }}>
|
|
358
|
+
{(scales || []).map((scale, scaleIndex) => (
|
|
359
|
+
<Scale
|
|
360
|
+
key={`scale-${scaleIndex}`}
|
|
361
|
+
scale={scale}
|
|
362
|
+
scaleIndex={scaleIndex}
|
|
363
|
+
errors={errors}
|
|
364
|
+
onScaleRemoved={this.onScaleRemoved}
|
|
365
|
+
onScaleChanged={this.onScaleChanged}
|
|
366
|
+
showStandards={standards}
|
|
367
|
+
showScorePointLabels={pointLabels}
|
|
368
|
+
showDescription={description}
|
|
369
|
+
showLevelTagInput={showLevelTagInput.enabled}
|
|
370
|
+
excludeZero={excludeZero}
|
|
371
|
+
enableDragAndDrop={dragAndDrop.enabled}
|
|
372
|
+
spellCheck={spellCheckEnabled}
|
|
373
|
+
width={adjustedWidth}
|
|
374
|
+
uploadSoundSupport={uploadSoundSupport}
|
|
375
|
+
maxPointsEnabled={maxPointsEnabled}
|
|
376
|
+
maxNoOfTraits={maxNoOfTraits}
|
|
377
|
+
minNoOfTraits={minNoOfTraits}
|
|
378
|
+
imageSupport={imageSupport}
|
|
379
|
+
{...this.props}
|
|
380
|
+
mathMlOptions={mathMlOptions}
|
|
381
|
+
maxMaxPoints={maxMaxPoints}
|
|
382
|
+
expandedPluginProps={getPluginProps(expandedInput?.inputConfiguration)}
|
|
383
|
+
labelPluginProps={getPluginProps(labelInput?.inputConfiguration)}
|
|
384
|
+
/>
|
|
385
|
+
))}
|
|
386
|
+
{addScaleEnabled && <MultiTraitButton onClick={this.onScaleAdded}>Add Scale</MultiTraitButton>}
|
|
387
|
+
</StyledDiv>
|
|
388
|
+
|
|
389
|
+
<InfoDialog open={showInfoDialog} text={infoDialogText} onClose={() => this.set({ showInfoDialog: false })} />
|
|
390
|
+
</layout.ConfigLayout>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
Main.propTypes = {
|
|
396
|
+
model: PropTypes.object,
|
|
397
|
+
uploadSoundSupport: PropTypes.object,
|
|
398
|
+
configuration: PropTypes.object,
|
|
399
|
+
onModelChanged: PropTypes.func,
|
|
400
|
+
onConfigurationChanged: PropTypes.func,
|
|
401
|
+
imageSupport: PropTypes.shape({
|
|
402
|
+
add: PropTypes.func.isRequired,
|
|
403
|
+
delete: PropTypes.func.isRequired,
|
|
404
|
+
}),
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export default Main;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/multi-trait-rubric/configure/src/modals.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import { styled } from '@mui/material/styles';
|
|
14
|
+
import Dialog from '@mui/material/Dialog';
|
|
15
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
16
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
17
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
18
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
19
|
+
import Button from '@mui/material/Button';
|
|
20
|
+
import { color } from '@pie-lib/render-ui';
|
|
21
|
+
|
|
22
|
+
import defaults from './defaults.js';
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
configuration: {
|
|
26
|
+
excludeZeroDialogBoxContent,
|
|
27
|
+
includeZeroDialogBoxContent,
|
|
28
|
+
deleteScaleDialogBoxContent,
|
|
29
|
+
maxPointsDialogBoxContent,
|
|
30
|
+
},
|
|
31
|
+
} = defaults;
|
|
32
|
+
|
|
33
|
+
export const excludeZeroTypes = {
|
|
34
|
+
remove0: 'remove0',
|
|
35
|
+
add0: 'add0',
|
|
36
|
+
shiftLeft: 'shiftLeft',
|
|
37
|
+
shiftRight: 'shiftRight',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const StyledDialog: any = styled(Dialog)(({ theme }) => ({
|
|
41
|
+
'& .MuiPaper-root': {
|
|
42
|
+
padding: theme.spacing(2.5),
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const StyledDialogTitle: any = styled(DialogTitle)(({ theme }) => ({
|
|
47
|
+
padding: `0 0 ${theme.spacing(2)} 0`,
|
|
48
|
+
|
|
49
|
+
'& h2': {
|
|
50
|
+
fontSize: '20px',
|
|
51
|
+
lineHeight: '23px',
|
|
52
|
+
fontFamily: 'Cerebri Sans',
|
|
53
|
+
color: color.text(),
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
const StyledDialogContent: any = styled(DialogContent)(({ theme }) => ({
|
|
58
|
+
paddingLeft: '0',
|
|
59
|
+
|
|
60
|
+
'& p': {
|
|
61
|
+
fontSize: theme.typography.fontSize + 2,
|
|
62
|
+
fontFamily: 'Cerebri Sans',
|
|
63
|
+
color: color.text(),
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
const StyledButton: any = styled(Button)(({ theme }) => ({
|
|
68
|
+
padding: `${theme.spacing(1.5)} ${theme.spacing(2)}`,
|
|
69
|
+
borderRadius: '4px',
|
|
70
|
+
fontSize: theme.typography.fontSize,
|
|
71
|
+
fontFamily: 'Cerebri Sans',
|
|
72
|
+
lineHeight: '14px',
|
|
73
|
+
textTransform: 'none',
|
|
74
|
+
background: color.primary(),
|
|
75
|
+
color: theme.palette.common.white,
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
const CancelButton: any = styled(StyledButton)({
|
|
79
|
+
background: color.secondaryBackground(),
|
|
80
|
+
color: color.text(),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const ExcludeZeroDialog = ({ open, changeExcludeZero, cancel }) => (
|
|
84
|
+
<StyledDialog open={open}>
|
|
85
|
+
<StyledDialogTitle>{excludeZeroDialogBoxContent.title}</StyledDialogTitle>
|
|
86
|
+
|
|
87
|
+
<StyledDialogContent>
|
|
88
|
+
<DialogContentText>
|
|
89
|
+
<div dangerouslySetInnerHTML={{ __html: excludeZeroDialogBoxContent.text }} />
|
|
90
|
+
</DialogContentText>
|
|
91
|
+
</StyledDialogContent>
|
|
92
|
+
|
|
93
|
+
<DialogActions>
|
|
94
|
+
<CancelButton onClick={() => cancel()}>
|
|
95
|
+
Cancel
|
|
96
|
+
</CancelButton>
|
|
97
|
+
|
|
98
|
+
<StyledButton onClick={() => changeExcludeZero(excludeZeroTypes.shiftLeft)}>
|
|
99
|
+
Shift to Left
|
|
100
|
+
</StyledButton>
|
|
101
|
+
|
|
102
|
+
<StyledButton onClick={() => changeExcludeZero(excludeZeroTypes.remove0)}>
|
|
103
|
+
Remove 0 column
|
|
104
|
+
</StyledButton>
|
|
105
|
+
</DialogActions>
|
|
106
|
+
</StyledDialog>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
ExcludeZeroDialog.propTypes = {
|
|
110
|
+
open: PropTypes.bool,
|
|
111
|
+
changeExcludeZero: PropTypes.func,
|
|
112
|
+
cancel: PropTypes.func,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const IncludeZeroDialog = ({ open, changeExcludeZero, cancel }) => (
|
|
116
|
+
<StyledDialog open={open}>
|
|
117
|
+
<StyledDialogTitle>{includeZeroDialogBoxContent.title}</StyledDialogTitle>
|
|
118
|
+
|
|
119
|
+
<StyledDialogContent>
|
|
120
|
+
<DialogContentText>
|
|
121
|
+
<div dangerouslySetInnerHTML={{ __html: includeZeroDialogBoxContent.text }} />
|
|
122
|
+
</DialogContentText>
|
|
123
|
+
</StyledDialogContent>
|
|
124
|
+
|
|
125
|
+
<DialogActions>
|
|
126
|
+
<CancelButton onClick={() => cancel()}>
|
|
127
|
+
Cancel
|
|
128
|
+
</CancelButton>
|
|
129
|
+
|
|
130
|
+
<StyledButton onClick={() => changeExcludeZero(excludeZeroTypes.shiftRight)}>
|
|
131
|
+
Shift to Right
|
|
132
|
+
</StyledButton>
|
|
133
|
+
|
|
134
|
+
<StyledButton onClick={() => changeExcludeZero(excludeZeroTypes.add0)}>
|
|
135
|
+
Add 0 column
|
|
136
|
+
</StyledButton>
|
|
137
|
+
</DialogActions>
|
|
138
|
+
</StyledDialog>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
IncludeZeroDialog.propTypes = {
|
|
142
|
+
open: PropTypes.bool,
|
|
143
|
+
changeExcludeZero: PropTypes.func,
|
|
144
|
+
cancel: PropTypes.func,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const DecreaseMaxPoints = ({ open, deleteScorePoints, cancel }) => (
|
|
148
|
+
<StyledDialog open={open}>
|
|
149
|
+
<StyledDialogTitle>{maxPointsDialogBoxContent.title}</StyledDialogTitle>
|
|
150
|
+
|
|
151
|
+
<StyledDialogContent>
|
|
152
|
+
<DialogContentText>
|
|
153
|
+
<div dangerouslySetInnerHTML={{ __html: maxPointsDialogBoxContent.text }} />
|
|
154
|
+
</DialogContentText>
|
|
155
|
+
</StyledDialogContent>
|
|
156
|
+
|
|
157
|
+
<DialogActions>
|
|
158
|
+
<CancelButton onClick={cancel}>
|
|
159
|
+
Cancel
|
|
160
|
+
</CancelButton>
|
|
161
|
+
|
|
162
|
+
<StyledButton onClick={deleteScorePoints}>
|
|
163
|
+
Confirm
|
|
164
|
+
</StyledButton>
|
|
165
|
+
</DialogActions>
|
|
166
|
+
</StyledDialog>
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
DecreaseMaxPoints.propTypes = {
|
|
170
|
+
open: PropTypes.bool,
|
|
171
|
+
deleteScorePoints: PropTypes.func,
|
|
172
|
+
cancel: PropTypes.func,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const DeleteScale = ({ open, scaleIndex, deleteScale, cancel }) => (
|
|
176
|
+
<StyledDialog open={open}>
|
|
177
|
+
<StyledDialogTitle>
|
|
178
|
+
{`${deleteScaleDialogBoxContent.title} #${scaleIndex + 1}`}
|
|
179
|
+
</StyledDialogTitle>
|
|
180
|
+
|
|
181
|
+
<StyledDialogContent>
|
|
182
|
+
<DialogContentText>
|
|
183
|
+
<div dangerouslySetInnerHTML={{ __html: deleteScaleDialogBoxContent.text }} />
|
|
184
|
+
</DialogContentText>
|
|
185
|
+
</StyledDialogContent>
|
|
186
|
+
|
|
187
|
+
<DialogActions>
|
|
188
|
+
<CancelButton onClick={cancel}>
|
|
189
|
+
Cancel
|
|
190
|
+
</CancelButton>
|
|
191
|
+
|
|
192
|
+
<StyledButton onClick={deleteScale}>
|
|
193
|
+
Delete
|
|
194
|
+
</StyledButton>
|
|
195
|
+
</DialogActions>
|
|
196
|
+
</StyledDialog>
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
DeleteScale.propTypes = {
|
|
200
|
+
open: PropTypes.bool,
|
|
201
|
+
scaleIndex: PropTypes.number,
|
|
202
|
+
deleteScale: PropTypes.func,
|
|
203
|
+
cancel: PropTypes.func,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const DeleteTrait = ({ open, deleteTrait, cancel, traitLabel }) => (
|
|
207
|
+
<StyledDialog open={open}>
|
|
208
|
+
<StyledDialogTitle>Delete {traitLabel}</StyledDialogTitle>
|
|
209
|
+
|
|
210
|
+
<StyledDialogContent>
|
|
211
|
+
<DialogContentText>
|
|
212
|
+
<div dangerouslySetInnerHTML={{ __html: `Are you sure you want to delete this ${traitLabel}?` }} />
|
|
213
|
+
</DialogContentText>
|
|
214
|
+
</StyledDialogContent>
|
|
215
|
+
|
|
216
|
+
<DialogActions>
|
|
217
|
+
<CancelButton onClick={cancel}>
|
|
218
|
+
Cancel
|
|
219
|
+
</CancelButton>
|
|
220
|
+
|
|
221
|
+
<StyledButton onClick={deleteTrait}>
|
|
222
|
+
Delete
|
|
223
|
+
</StyledButton>
|
|
224
|
+
</DialogActions>
|
|
225
|
+
</StyledDialog>
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
DeleteTrait.propTypes = {
|
|
229
|
+
open: PropTypes.bool,
|
|
230
|
+
deleteTrait: PropTypes.func,
|
|
231
|
+
cancel: PropTypes.func,
|
|
232
|
+
traitLabel: PropTypes.string,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const InfoDialog = ({ open, text, onClose }) => (
|
|
236
|
+
<StyledDialog open={open}>
|
|
237
|
+
<StyledDialogTitle>{text}</StyledDialogTitle>
|
|
238
|
+
|
|
239
|
+
<DialogActions>
|
|
240
|
+
<StyledButton onClick={onClose}>
|
|
241
|
+
OK
|
|
242
|
+
</StyledButton>
|
|
243
|
+
</DialogActions>
|
|
244
|
+
</StyledDialog>
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
InfoDialog.propTypes = {
|
|
248
|
+
open: PropTypes.bool,
|
|
249
|
+
text: PropTypes.string,
|
|
250
|
+
cancel: PropTypes.func,
|
|
251
|
+
onClose: PropTypes.func,
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export { ExcludeZeroDialog, IncludeZeroDialog, DecreaseMaxPoints, DeleteScale, DeleteTrait, InfoDialog };
|