@agilemotion/oui-react-js 1.7.9 → 1.8.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.
@@ -49,7 +49,7 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
49
49
  actionConfig = {};
50
50
  }
51
51
  actionConfig.service = service;
52
- // TODO : Implement the invalid paramenter callback
52
+ // TODO : Implement the invalid parameter callback
53
53
  _ServiceCallActionHandler.default.execute(actionConfig, null, null, props.viewId, data => {
54
54
  let file = {};
55
55
  if (data.payloadBase64) {
@@ -68,6 +68,8 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
68
68
  console.error(e);
69
69
  setHasLoadingError(true);
70
70
  setLoading(false);
71
+ }, () => {
72
+ setLoading(false);
71
73
  });
72
74
  }
73
75
  } else {
@@ -127,7 +129,7 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
127
129
  }, "Error loading document"), !loading && !hasLoadingError && props.config.fileType === 'application/pdf' && !_Utils.default.isNull(value) && /*#__PURE__*/_react.default.createElement(_PDFViewer.default, {
128
130
  file: value,
129
131
  onDocumentLoadSuccess: () => {}
130
- }), !loading && !hasLoadingError && props.config.fileType === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' && !_Utils.default.isNull(value) && /*#__PURE__*/_react.default.createElement(_WordDocumentViewer.default, {
132
+ }), !loading && !hasLoadingError && props.config.fileType === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' && (!_Utils.default.isNull(value) || props.config.enableUpload) && /*#__PURE__*/_react.default.createElement(_WordDocumentViewer.default, {
131
133
  file: value,
132
134
  onDocumentLoadSuccess: () => {},
133
135
  valueHandler: wordEditorValueHandler,
@@ -135,7 +137,9 @@ const DocumentViewer = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.def
135
137
  disableRejectChanges: props.config.disableRejectChanges,
136
138
  disableAcceptChanges: props.config.disableAcceptChanges,
137
139
  readOnly: props.config.readOnly,
138
- commentsOnly: props.config.commentsOnly
140
+ commentsOnly: props.config.commentsOnly,
141
+ enableUpload: props.config.enableUpload,
142
+ trackChanges: props.config.trackChanges
139
143
  }));
140
144
  }));
141
145
  var _default = exports.default = DocumentViewer;
@@ -13,6 +13,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
13
13
  const TableCellContent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
14
14
  const [contentType] = _react.default.useState(props.contentType);
15
15
  const [refresher, setRefresher] = _react.default.useState(true);
16
+ const [editor, setEditor] = _react.default.useState(null);
16
17
  const editorValue = _react.default.useRef(null);
17
18
  const validate = value => {
18
19
  let validator = props.validator;
@@ -64,12 +65,23 @@ const TableCellContent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.d
64
65
  }, [props.row, props.editor]);
65
66
  _react.default.useEffect(() => {
66
67
  if (!_Utils.default.isNull(props.editor)) {
67
- props.editor.id = props.editor.id.replace('.', '_');
68
- if (_Utils.default.isNull(props.editor.attributes)) {
69
- props.editor.attributes = {};
68
+ let e = {
69
+ ...props.editor,
70
+ id: props.editor.id.replace('.', '_')
71
+ };
72
+ if (_Utils.default.isNull(e.attributes)) {
73
+ e.attributes = {};
70
74
  }
71
- props.editor.attributes['minWidth'] = 0;
72
-
75
+ if (_Utils.default.isNull(e.attributes.style)) {
76
+ e.attributes.style = {};
77
+ }
78
+ if (_Utils.default.isNull(e.attributes.containerStyle)) {
79
+ e.attributes.containerStyle = {};
80
+ }
81
+ e.attributes.style.minWidth = e.attributes.style.minWidth ? e.attributes.style.minWidth : 0;
82
+ e.attributes.style.width = e.attributes.style.width ? e.attributes.style.width : 'calc(100% - 8px)';
83
+ e.attributes.containerStyle.minWidth = e.attributes.containerStyle.minWidth ? e.attributes.containerStyle.minWidth : 0;
84
+ setEditor(e);
73
85
  // This forces the editable grid to validate its initial value
74
86
  let value = props.row[props.dataBinding];
75
87
  valueChangeHandler(_Utils.default.isNull(value) ? null : value);
@@ -131,10 +143,11 @@ const TableCellContent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.d
131
143
  type: "fieldSet",
132
144
  attributes: {
133
145
  style: {
134
- "width": "100%"
146
+ "width": "100%",
147
+ "minWidth": "0"
135
148
  }
136
149
  },
137
- fields: [props.editor]
150
+ fields: [editor]
138
151
  }]
139
152
  }]
140
153
  };
@@ -189,6 +202,6 @@ const TableCellContent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.d
189
202
  }
190
203
  }
191
204
  };
192
- return render();
205
+ return (!props.editor || props.editor && editor) && render();
193
206
  }));
194
207
  var _default = exports.default = TableCellContent;
@@ -17,17 +17,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
17
  _ej2ReactDocumenteditor.DocumentEditorContainerComponent.Inject(_ej2ReactDocumenteditor.Toolbar);
18
18
  const WordDocumentViewer = props => {
19
19
  const [container, setContainer] = _react.default.useState(null);
20
+ const [items, setItems] = _react.default.useState(null);
20
21
  const [json, setJson] = _react.default.useState(null);
21
22
  const [errorMessage, setErrorMessage] = _react.default.useState(null);
22
- let items = ["Undo", "Redo", "Separator", {
23
- tooltipText: 'Bold',
24
- prefixIcon: 'e-icons e-bold',
25
- command: 'Bold'
26
- }, {
27
- tooltipText: 'Italic',
28
- prefixIcon: 'e-icons e-italic',
29
- command: 'Italic'
30
- }, "Separator", "Image", "Table", "Separator", "Header", "Footer", "PageSetup", "PageNumber", "Break", "InsertFootnote", "Separator", "Find", "Separator", "Comments"];
31
23
 
32
24
  /*let items = ['Bold', 'Italic', 'Underline', '|', 'Formats', '|', 'CreateLink', '|',
33
25
  {
@@ -50,7 +42,22 @@ const WordDocumentViewer = props => {
50
42
  props.valueHandler.api = api();
51
43
  });
52
44
  _react.default.useEffect(() => {
53
- if (props.file.base64) {
45
+ let toolbarItems = ["Undo", "Redo", "Separator", {
46
+ tooltipText: 'Bold',
47
+ prefixIcon: 'e-icons e-bold',
48
+ command: 'Bold'
49
+ }, {
50
+ tooltipText: 'Italic',
51
+ prefixIcon: 'e-icons e-italic',
52
+ command: 'Italic'
53
+ }, "Separator", "Image", "Table", "Separator", "Header", "Footer", "PageSetup", "PageNumber", "Break", "InsertFootnote", "Separator", "Find", "Separator", "Comments"];
54
+ if (props.enableUpload) {
55
+ toolbarItems.unshift("Open");
56
+ }
57
+ setItems(toolbarItems);
58
+ }, []);
59
+ _react.default.useEffect(() => {
60
+ if (props.file?.base64) {
54
61
  let base64 = props.file.base64;
55
62
  const arrayBuffer = _Utils.default.base64ToArrayBuffer(base64);
56
63
  const file = new Blob([arrayBuffer], {
@@ -96,7 +103,7 @@ const WordDocumentViewer = props => {
96
103
  _react.default.useEffect(() => {
97
104
  if (container && json) {
98
105
  container.documentEditor.documentChange = () => {
99
- container.documentEditor.enableTrackChanges = true;
106
+ container.documentEditor.enableTrackChanges = !_Utils.default.isNull(props.trackChanges) ? props.trackChanges : true;
100
107
  if (props.commentsOnly) {
101
108
  container.documentEditor.editor.enforceProtection('password', 'CommentsOnly');
102
109
  } else if (props.readOnly) {
@@ -118,7 +125,7 @@ const WordDocumentViewer = props => {
118
125
  }
119
126
  });
120
127
  container.documentEditor.open(json);
121
- container.documentEditor.enableTrackChanges = true;
128
+ container.documentEditor.enableTrackChanges = !_Utils.default.isNull(props.trackChanges) ? props.trackChanges : true;
122
129
  //container.documentEditor.isReadOnly = (props.readOnly || props.commentsOnly);
123
130
  }
124
131
  }, [json, container]);
@@ -145,7 +152,7 @@ const WordDocumentViewer = props => {
145
152
  style: {
146
153
  color: 'rgba(255, 255, 255, 0.8)'
147
154
  }
148
- }, errorMessage))), /*#__PURE__*/_react.default.createElement(_ej2ReactDocumenteditor.DocumentEditorContainerComponent, {
155
+ }, errorMessage))), items && (_Utils.default.isNull(props.trackChanges) || props.trackChanges === true) && /*#__PURE__*/_react.default.createElement(_ej2ReactDocumenteditor.DocumentEditorContainerComponent, {
149
156
  id: "container",
150
157
  height: '690px',
151
158
  ref: scope => {
@@ -162,6 +169,22 @@ const WordDocumentViewer = props => {
162
169
  enableTrackChanges: true,
163
170
  serviceUrl: "https://services.syncfusion.com/react/production/api/documenteditor/",
164
171
  enableToolbar: !(props.readOnly || props.commentsOnly)
172
+ }), items && props.trackChanges === false && /*#__PURE__*/_react.default.createElement(_ej2ReactDocumenteditor.DocumentEditorContainerComponent, {
173
+ id: "container",
174
+ height: '690px',
175
+ ref: scope => {
176
+ setContainer(scope);
177
+ },
178
+ created: () => {
179
+ if (container) {
180
+ container.resize();
181
+ container.documentEditor.resize();
182
+ }
183
+ },
184
+ toolbarItems: items,
185
+ showPropertiesPane: false,
186
+ serviceUrl: "https://services.syncfusion.com/react/production/api/documenteditor/",
187
+ enableToolbar: !(props.readOnly || props.commentsOnly)
165
188
  }));
166
189
  };
167
190
  var _default = exports.default = WordDocumentViewer;
@@ -343,7 +343,8 @@ const ModuleMenuSidebar = props => {
343
343
  className: "logo-img",
344
344
  style: {
345
345
  paddingTop: '16px',
346
- paddingBottom: '8px'
346
+ paddingBottom: '8px',
347
+ maxWidth: '140px'
347
348
  }
348
349
  }, /*#__PURE__*/_react.default.createElement("img", {
349
350
  src: logo.imgSrc,
@@ -498,7 +498,7 @@ const FieldSet = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
498
498
  }
499
499
  }
500
500
  width = colspan / fieldGrid.maxColPerRow * 100;
501
- let columnStyle = {
501
+ let containerStyle = {
502
502
  paddingLeft: '0',
503
503
  paddingRight: '0',
504
504
  marginLeft: '0',
@@ -506,7 +506,7 @@ const FieldSet = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
506
506
  minWidth: '320px',
507
507
  width: width + '%'
508
508
  };
509
- let style = field.attributes?.columnStyle ? _Utils.default.mergeObjects(field.attributes?.columnStyle, columnStyle) : columnStyle;
509
+ let style = field.attributes?.containerStyle ? _Utils.default.mergeObjects(field.attributes?.containerStyle, containerStyle) : containerStyle;
510
510
  return /*#__PURE__*/_react.default.createElement("div", {
511
511
  key: index,
512
512
  className: "col-*-*",
@@ -23,6 +23,8 @@ const LookupFieldComponent = exports.LookupFieldComponent = /*#__PURE__*/_react.
23
23
  const [open, setOpen] = _react.default.useState(false);
24
24
  const width = props.config.attributes?.style?.width ? props.config.attributes.style.width : "100%";
25
25
  const minWidth = props.config.attributes?.style?.minWidth ? props.config.attributes.style.minWidth : "240px";
26
+ const height = !_Utils.default.isNull(props.config.attributes?.style?.height) ? props.config.attributes.style.height : '52px';
27
+ const margin = !_Utils.default.isNull(props.config.attributes?.style?.margin) ? props.config.attributes.style.margin : '4px 0';
26
28
  const defaultValue = _Utils.default.isNull(props.value) ? '' : props.value;
27
29
  const base = props.base;
28
30
  const handleClose = () => {
@@ -67,19 +69,43 @@ const LookupFieldComponent = exports.LookupFieldComponent = /*#__PURE__*/_react.
67
69
  setOpen(true);
68
70
  };
69
71
  return /*#__PURE__*/_react.default.createElement("div", {
70
- className: "w-100 lookup"
71
- }, /*#__PURE__*/_react.default.createElement("table", {
72
- className: "w-100"
73
- }, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
74
- width: "90%"
72
+ className: "w-100 lookup row no-margin no-padding",
73
+ style: {
74
+ width: width,
75
+ minWidth: minWidth,
76
+ margin: margin,
77
+ height: height
78
+ }
79
+ }, /*#__PURE__*/_react.default.createElement("div", {
80
+ className: 'col-*-*',
81
+ style: {
82
+ width: '72px',
83
+ marginRight: '8px',
84
+ height: '100%'
85
+ }
86
+ }, /*#__PURE__*/_react.default.createElement(_Button.default, {
87
+ style: {
88
+ height: '100%'
89
+ },
90
+ variant: 'outlined',
91
+ onClick: openSearch,
92
+ disabled: base.disabled,
93
+ "aria-label": "search"
94
+ }, "...")), /*#__PURE__*/_react.default.createElement("div", {
95
+ className: 'col-*-* no-margin no-padding',
96
+ style: {
97
+ width: 'calc(100% - 80px)',
98
+ marginBottom: base.value ? '0' : '8px'
99
+ }
75
100
  }, /*#__PURE__*/_react.default.createElement(_TextField.default, {
76
101
  InputProps: {
77
- readOnly: true
102
+ readOnly: true,
103
+ disableUnderline: true
78
104
  },
79
105
  id: props.id,
80
106
  ref: ref,
81
107
  required: base.required,
82
- disabled: base.disabled,
108
+ disabled: true,
83
109
  label: !_Utils.default.isNull(props.config.attributes) && !_Utils.default.isNull(props.config.attributes['label']) ? props.config.attributes['label'] : null,
84
110
  value: base.value?.__oui_label || base.value?.dataRecordDescription || defaultValue,
85
111
  className: props.className,
@@ -88,19 +114,12 @@ const LookupFieldComponent = exports.LookupFieldComponent = /*#__PURE__*/_react.
88
114
  size: "small",
89
115
  margin: "dense",
90
116
  style: {
91
- minWidth: minWidth,
92
- width: width,
93
- color: 'secondary'
94
- },
95
- variant: "outlined"
96
- })), /*#__PURE__*/_react.default.createElement("td", {
97
- valign: "middle",
98
- align: "left"
99
- }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
100
- onClick: openSearch,
101
- disabled: base.disabled,
102
- "aria-label": "search"
103
- }, /*#__PURE__*/_react.default.createElement(_Search.default, null)))))), /*#__PURE__*/_react.default.createElement(_Dialog.default, {
117
+ height: '48px',
118
+ width: '100%',
119
+ color: 'secondary',
120
+ border: 'none'
121
+ }
122
+ })), /*#__PURE__*/_react.default.createElement(_Dialog.default, {
104
123
  open: open,
105
124
  onClose: handleClose,
106
125
  "aria-labelledby": "form-dialog-title",
@@ -16,9 +16,9 @@ const SelectItemComponent = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_reac
16
16
  const base = props.base;
17
17
  const [optionsLoaded, setOptionsLoaded] = _react.default.useState(false);
18
18
  const [loadFullOptionList, setLoadFullOptionList] = _react.default.useState(false);
19
- const minWidth = _Utils.default.getComponentAttribute(props.config, 'minWidth', '240px');
20
- const maxWidth = _Utils.default.getComponentAttribute(props.config, 'maxWidth', null);
21
- const width = _Utils.default.getComponentAttribute(props.config, 'width', '100%');
19
+ const width = !_Utils.default.isNull(props.config.attributes?.style?.width) ? props.config.attributes.style.width : "100%";
20
+ const maxWidth = !_Utils.default.isNull(props.config.attributes?.style?.maxWidth) ? props.config.attributes.style.maxWidth : null;
21
+ const minWidth = !_Utils.default.isNull(props.config.attributes?.style?.minWidth) ? props.config.attributes.style.minWidth : "240px";
22
22
  const defaultValue = _Utils.default.isNull(props.value) ? '' : props.value.id;
23
23
  _react.default.useEffect(() => {
24
24
  if (!_Utils.default.isNull(base.value) && !optionsLoaded) {
@@ -15,10 +15,10 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
15
15
  const TextFieldWrapper = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef((props, ref) => {
16
16
  const base = props.base;
17
17
  const [multiline] = _react.default.useState(props.multiline);
18
- const width = props.config.attributes?.style?.width ? props.config.attributes.style.width : "100%";
19
- const maxWidth = props.config.attributes?.style?.maxWidth ? props.config.attributes.style.maxWidth : null;
20
- const minWidth = props.config.attributes?.style?.minWidth ? props.config.attributes.style.minWidth : "240px";
21
- const height = props.config.attributes?.style?.height ? props.config.attributes.style.height : multiline ? '200px' : null;
18
+ const width = !_Utils.default.isNull(props.config.attributes?.style?.width) ? props.config.attributes.style.width : "100%";
19
+ const maxWidth = !_Utils.default.isNull(props.config.attributes?.style?.maxWidth) ? props.config.attributes.style.maxWidth : null;
20
+ const minWidth = !_Utils.default.isNull(props.config.attributes?.style?.minWidth) ? props.config.attributes.style.minWidth : "240px";
21
+ const height = !_Utils.default.isNull(props.config.attributes?.style?.height) ? props.config.attributes.style.height : multiline ? '200px' : null;
22
22
  const rows = height === null ? 4 : height.replace('px', '') / 20 - 1;
23
23
  const secondaryColor = (0, _reactRedux.useSelector)(state => state.dashboard.secondaryThemeColor);
24
24
  const ThemedTextField = (0, _styles.withStyles)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agilemotion/oui-react-js",
3
- "version": "1.7.9",
3
+ "version": "1.8.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],