@agilemotion/oui-react-js 1.7.1 → 1.7.3
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/ApplicationManager.js +8 -3
- package/dist/BasicAppHome.js +1 -1
- package/dist/DynamicJS.js +5 -2
- package/dist/InteractionPortalAppHome.js +5 -0
- package/dist/RestService.js +344 -0
- package/dist/RestUtils.js +22 -8
- package/dist/Utils.js +9 -0
- package/dist/components/AlertBar.js +3 -0
- package/dist/components/DataGrid.js +72 -43
- package/dist/components/DocumentTemplateDesigner.css +2 -2
- package/dist/components/DocumentTemplateDesigner.js +43 -31
- package/dist/components/DocumentTemplateDesignerComponent.css +15 -0
- package/dist/components/DocumentTemplateDesignerComponent.js +368 -72
- package/dist/components/DocumentTemplatePlaceholderDialog.js +6 -6
- package/dist/components/DocumentViewer.css +10 -0
- package/dist/components/DocumentViewer.js +95 -45
- package/dist/components/Graph.js +12 -2
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/{DocumentViewerComponent.js → PDFViewer.js} +2 -2
- package/dist/components/TabPage.js +7 -3
- package/dist/components/TabPanel.js +13 -3
- package/dist/components/TableCellContent.js +21 -4
- package/dist/components/TemplateDesigner.css +3 -2
- package/dist/components/TemplateDesigner.js +3 -1
- package/dist/components/TemplateItemEventHandler.js +30 -15
- package/dist/components/Toolbar.js +3 -1
- package/dist/components/Tree.js +5 -5
- package/dist/components/WordDocumentViewer.js +167 -0
- package/dist/components/dashboard/SideMenuModuleDashboard.js +1 -3
- package/dist/components/dashboard/components/blackDashboard/sidebar/ModuleMenuSidebar.css +4 -0
- package/dist/components/dashboard/components/blackDashboard/sidebar/ModuleMenuSidebar.js +131 -159
- package/dist/components/form/AutoComplete.js +28 -6
- package/dist/components/form/BaseField.js +3 -3
- package/dist/components/form/DatePicker.js +7 -2
- package/dist/components/form/FieldSet.js +24 -8
- package/dist/components/form/Form.js +4 -3
- package/dist/components/form/GridField.js +13 -37
- package/dist/components/form/LookupField.js +23 -23
- package/dist/components/form/RadioGroup.js +2 -1
- package/dist/components/form/Section.js +4 -0
- package/dist/components/form/SelectItem.js +2 -3
- package/dist/components/form/TextField.js +6 -6
- package/dist/components/layout/Layout.js +24 -15
- package/dist/components/menu/MenuButton.js +12 -7
- package/dist/components/menu/MenuLink.js +6 -0
- package/dist/components/signatures/AgilitySignaturePanel.js +33 -14
- package/dist/components/signatures/DocumentContainer.css +26 -1
- package/dist/components/signatures/DocumentContainer.js +55 -10
- package/dist/components/signatures/SignatureInputProps.js +59 -9
- package/dist/components/signatures/SignatureTemplateDesigner.js +71 -38
- package/dist/event/ActionHandlers.js +7 -4
- package/dist/event/RouteActionHandler.js +3 -3
- package/dist/event/ScriptActionHandler.js +2 -2
- package/dist/event/ServiceCallActionHandler.js +73 -28
- package/dist/js/Docs.js +57 -10
- package/dist/view/Dashboard.js +3 -3
- package/package.json +10 -5
- package/dist/components/DocumentView.css +0 -4
|
@@ -4,104 +4,400 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _ej2ReactDocumenteditor = require("@syncfusion/ej2-react-documenteditor");
|
|
8
|
+
var _ej2Base = require("@syncfusion/ej2-base");
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var React = _react;
|
|
10
|
-
var _DocumentTemplatePlaceholderDialog = _interopRequireDefault(require("./DocumentTemplatePlaceholderDialog"));
|
|
11
|
-
var _mammoth = _interopRequireDefault(require("mammoth"));
|
|
12
|
-
var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
|
|
13
11
|
require("./DocumentTemplateDesignerComponent.css");
|
|
12
|
+
var _ApplicationManager = _interopRequireDefault(require("../ApplicationManager"));
|
|
13
|
+
var _Form = _interopRequireDefault(require("./form/Form"));
|
|
14
|
+
var _EventType = _interopRequireDefault(require("../event/EventType"));
|
|
15
|
+
var _Observable = _interopRequireDefault(require("../event/Observable"));
|
|
16
|
+
var _Utils = _interopRequireDefault(require("../Utils"));
|
|
17
|
+
var _reactPromiseTracker = require("react-promise-tracker");
|
|
14
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
(0, _ej2Base.registerLicense)('ORg4AjUWIQA/Gnt2U1hhQlJBfV5AQmBIYVp/TGpJfl96cVxMZVVBJAtUQF1hTX5adkJiWHtWdXBXT2Je');
|
|
22
|
+
_ej2ReactDocumenteditor.DocumentEditorContainerComponent.Inject(_ej2ReactDocumenteditor.Toolbar);
|
|
17
23
|
const DocumentTemplateDesignerComponent = props => {
|
|
18
24
|
const {
|
|
19
25
|
contractTemplate,
|
|
20
26
|
uploadTrigger,
|
|
21
27
|
valueChangeHandler,
|
|
22
|
-
addDocumentMetaDataHandler
|
|
28
|
+
addDocumentMetaDataHandler,
|
|
29
|
+
value
|
|
23
30
|
} = props;
|
|
24
|
-
const [
|
|
25
|
-
const
|
|
26
|
-
const [
|
|
27
|
-
const
|
|
31
|
+
const [container, setContainer] = React.useState(null);
|
|
32
|
+
const model = React.useRef({});
|
|
33
|
+
const [doc, setDoc] = React.useState(null);
|
|
34
|
+
const [file, setFile] = React.useState(null);
|
|
35
|
+
const [contentState] = React.useState({
|
|
36
|
+
changed: false
|
|
37
|
+
});
|
|
28
38
|
const btnRef = (0, _react.useRef)(null);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
const currentVal = (0, _react.useRef)(null);
|
|
40
|
+
const propertiesFormHandle = React.useRef({});
|
|
41
|
+
const onToolbarClick = args => {
|
|
42
|
+
switch (args.item.id) {
|
|
43
|
+
case "Custom":
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
38
48
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const onWrapText = text => {
|
|
50
|
+
let content = '';
|
|
51
|
+
const index = text.lastIndexOf(' ');
|
|
52
|
+
if (index !== -1) {
|
|
53
|
+
content = text.slice(0, index) + "<div class='e-de-text-wrap'>" + text.slice(index + 1) + "</div>";
|
|
54
|
+
} else {
|
|
55
|
+
content = text;
|
|
56
|
+
}
|
|
57
|
+
return content;
|
|
58
|
+
};
|
|
59
|
+
const findNext = () => {
|
|
60
|
+
container.documentEditor.search.searchResults.index = container.documentEditor.search.searchResults.index + 1;
|
|
61
|
+
};
|
|
62
|
+
const findPrev = () => {
|
|
63
|
+
container.documentEditor.search.searchResults.index = container.documentEditor.search.searchResults.index - 1;
|
|
64
|
+
};
|
|
65
|
+
let next = {
|
|
66
|
+
prefixIcon: "e-chevron-down",
|
|
67
|
+
click: findNext.bind(void 0),
|
|
68
|
+
tooltipText: 'Next placeholder',
|
|
69
|
+
text: '',
|
|
70
|
+
id: "NextPlaceHolder"
|
|
71
|
+
};
|
|
72
|
+
let previous = {
|
|
73
|
+
prefixIcon: "e-chevron-up",
|
|
74
|
+
click: findPrev.bind(void 0),
|
|
75
|
+
tooltipText: 'Previous placeholder',
|
|
76
|
+
text: '',
|
|
77
|
+
id: "PrevPlaceHolder"
|
|
78
|
+
};
|
|
79
|
+
let apply = {
|
|
80
|
+
prefixIcon: "e-icons e-save",
|
|
81
|
+
click: applyChanges.bind(void 0),
|
|
82
|
+
tooltipText: 'Previous placeholder',
|
|
83
|
+
text: 'Apply',
|
|
84
|
+
id: "PrevPlaceHolder"
|
|
85
|
+
};
|
|
86
|
+
let items = ["Open", apply, "Undo", "Redo", "Separator", {
|
|
87
|
+
tooltipText: 'Bold',
|
|
88
|
+
prefixIcon: 'e-icons e-bold',
|
|
89
|
+
command: 'Bold'
|
|
90
|
+
}, {
|
|
91
|
+
tooltipText: 'Italic',
|
|
92
|
+
prefixIcon: 'e-icons e-italic',
|
|
93
|
+
command: 'Italic'
|
|
94
|
+
}, "Separator", "Image", "Table", "Separator", "Header", "Footer", "PageSetup", "PageNumber", "InsertFootnote", "Separator", "Find"];
|
|
95
|
+
let searchHighlightColor = {
|
|
96
|
+
searchHighlightColor: 'Red'
|
|
97
|
+
};
|
|
98
|
+
const saveDoc = () => {
|
|
99
|
+
return new Promise((accept, reject) => {
|
|
100
|
+
if (container && container.documentEditor) {
|
|
101
|
+
container.documentEditor.saveAsBlob('Docx').then(blob => {
|
|
102
|
+
accept(blob);
|
|
103
|
+
}).catch(e => {
|
|
104
|
+
console.error("Error saving document");
|
|
105
|
+
reject(e);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const onContentChange = () => {
|
|
111
|
+
contentState.changed = true;
|
|
112
|
+
};
|
|
113
|
+
(0, _react.useEffect)(() => {
|
|
114
|
+
if (uploadTrigger != null && btnRef.current) {
|
|
115
|
+
btnRef.current.click();
|
|
116
|
+
}
|
|
117
|
+
}, [uploadTrigger]);
|
|
118
|
+
(0, _react.useEffect)(() => {
|
|
119
|
+
if (value) {
|
|
120
|
+
let i = 0;
|
|
121
|
+
for (const property of value.properties) {
|
|
122
|
+
property.id = i++;
|
|
123
|
+
}
|
|
124
|
+
propertiesFormHandle.current.api.model = {
|
|
125
|
+
properties: value.properties
|
|
126
|
+
};
|
|
127
|
+
if (value.file && value.file.url) {
|
|
128
|
+
let tokens = value.file.url.split(';base64,');
|
|
129
|
+
let type = tokens[0].replace("data:", "");
|
|
130
|
+
let base64 = tokens[1];
|
|
131
|
+
const arrayBuffer = _Utils.default.base64ToArrayBuffer(base64);
|
|
132
|
+
const file = new Blob([arrayBuffer], {
|
|
133
|
+
type
|
|
134
|
+
});
|
|
135
|
+
const formData = new FormData();
|
|
136
|
+
formData.append('files', file, 'document.docx');
|
|
137
|
+
(0, _reactPromiseTracker.trackPromise)(fetch('https://ej2services.syncfusion.com/production/web-services/api/documenteditor/Import', {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
body: formData
|
|
140
|
+
}).then(response => {
|
|
141
|
+
(0, _reactPromiseTracker.trackPromise)(response.json().then(json => {
|
|
142
|
+
container.documentEditor.open(json);
|
|
143
|
+
}));
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, [value]);
|
|
148
|
+
const getFooterText = () => {
|
|
149
|
+
container.documentEditor.selection.goToFooter();
|
|
150
|
+
container.documentEditor.selection.selectAll();
|
|
151
|
+
let footerText = container.documentEditor.selection.getText();
|
|
152
|
+
container.documentEditor.selection.closeHeaderFooter();
|
|
153
|
+
container.documentEditor.selection.clear();
|
|
154
|
+
return footerText;
|
|
155
|
+
};
|
|
156
|
+
function applyChanges() {
|
|
157
|
+
setup();
|
|
44
158
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
159
|
+
function setup() {
|
|
160
|
+
let initialFormValue = {
|
|
161
|
+
properties: []
|
|
162
|
+
};
|
|
163
|
+
if (container) {
|
|
164
|
+
container.documentEditor.selection.selectAll();
|
|
165
|
+
const text = container.documentEditor.selection.getText();
|
|
166
|
+
container.documentEditor.selection.clear();
|
|
167
|
+
const bodyMatches = removeNextLineCharsFromPlaceholders(text, '<<', '>>');
|
|
168
|
+
const footerText = getFooterText();
|
|
169
|
+
let footerMatches = removeNextLineCharsFromPlaceholders(footerText, '<<', '>>');
|
|
170
|
+
const matches = bodyMatches.concat(footerMatches);
|
|
171
|
+
|
|
172
|
+
//container.documentEditor.editor.enforceProtection('password', 'CommentsOnly');
|
|
173
|
+
//container.documentEditor.search.findAll(/<<[\s\S]*?>>/g);
|
|
174
|
+
|
|
175
|
+
matches.forEach(match => {
|
|
176
|
+
let prop = model.current.properties.find(p => p.placeHolder === match.text);
|
|
177
|
+
if (!prop) {
|
|
178
|
+
prop = {
|
|
179
|
+
placeHolder: match.text
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (!initialFormValue.properties.find(p => p.placeHolder === match.text)) {
|
|
183
|
+
initialFormValue.properties.push(prop);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
let i = 0;
|
|
187
|
+
for (const property of initialFormValue.properties) {
|
|
188
|
+
property.id = i++;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
//console.log("\n\n\n\n\n\nINITITIAL VALUES : ", initialFormValue);
|
|
192
|
+
propertiesFormHandle.current.api.model = initialFormValue;
|
|
193
|
+
saveDoc().then(blob => {
|
|
194
|
+
const newFile = new File([blob], props.documentName, {
|
|
195
|
+
type: blob.type
|
|
196
|
+
});
|
|
197
|
+
setFile(newFile);
|
|
198
|
+
if (contentState.changed) {
|
|
199
|
+
if (!initialFormValue) {
|
|
200
|
+
valueChangeHandler(null);
|
|
201
|
+
} else {
|
|
202
|
+
valueChangeHandler({
|
|
203
|
+
properties: initialFormValue.properties,
|
|
204
|
+
file: newFile
|
|
58
205
|
});
|
|
59
|
-
rteObj.executeCommand('insertHTML', value);
|
|
60
|
-
addDocumentMetaDataHandler(file, value);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
setError('Error processing the file. Please ensure it is a valid .docx file.');
|
|
63
206
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
207
|
+
}
|
|
208
|
+
contentState.changed = false;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
(0, _react.useEffect)(() => {
|
|
213
|
+
setup();
|
|
214
|
+
}, [doc]);
|
|
215
|
+
const validateProps = properties => {
|
|
216
|
+
let valid = properties && properties.length > 0;
|
|
217
|
+
if (valid) {
|
|
218
|
+
for (const property of properties) {
|
|
219
|
+
if (!property.valueField) {
|
|
220
|
+
valid = false;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
68
223
|
}
|
|
69
224
|
}
|
|
225
|
+
return valid;
|
|
70
226
|
};
|
|
227
|
+
const removeNextLineCharsFromPlaceholders = (text, startTag, endTag) => {
|
|
228
|
+
const matches = [];
|
|
229
|
+
let index = 0;
|
|
230
|
+
while (index < text.length) {
|
|
231
|
+
const startIndex = text.indexOf(startTag, index);
|
|
232
|
+
if (startIndex === -1) break;
|
|
233
|
+
const endIndex = text.indexOf(endTag, startIndex + startTag.length);
|
|
234
|
+
if (endIndex === -1) break;
|
|
235
|
+
let find = text.substring(startIndex, endIndex + endTag.length);
|
|
236
|
+
let split = find.split("\r");
|
|
237
|
+
if (split.length > 1) {
|
|
238
|
+
container.documentEditor.search.find(split[0]);
|
|
239
|
+
let startPosition = container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList[0].startIn;
|
|
240
|
+
container.documentEditor.search.find(split[split.length - 1]);
|
|
241
|
+
let endPosition = container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList[0].endIn;
|
|
242
|
+
let selection = container.documentEditor.selection;
|
|
243
|
+
selection.selectRange(startPosition, endPosition);
|
|
244
|
+
if (selection && selection.start && selection.end) {
|
|
245
|
+
let selectedText = selection.getText();
|
|
246
|
+
container.documentEditor.editor.delete();
|
|
247
|
+
container.documentEditor.editor.insertText(selectedText.replace(/(\r\n|\n|\r)/gm, ""));
|
|
248
|
+
} else {
|
|
249
|
+
console.error("No valid selection found");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
matches.push({
|
|
253
|
+
start: startIndex,
|
|
254
|
+
end: endIndex + endTag.length,
|
|
255
|
+
text: find.replace(/(\r\n|\n|\r)/gm, "")
|
|
256
|
+
});
|
|
257
|
+
index = endIndex + endTag.length;
|
|
258
|
+
}
|
|
259
|
+
return matches;
|
|
260
|
+
};
|
|
261
|
+
function setupContainer() {
|
|
262
|
+
container.documentEditor.currentUser = _ApplicationManager.default.getUserDetails().name + " " + _ApplicationManager.default.getUserDetails().surname;
|
|
263
|
+
}
|
|
71
264
|
(0, _react.useEffect)(() => {
|
|
72
|
-
if (
|
|
73
|
-
|
|
265
|
+
if (container) {
|
|
266
|
+
setupContainer();
|
|
267
|
+
//autoSave();
|
|
74
268
|
}
|
|
75
|
-
}, [
|
|
76
|
-
|
|
269
|
+
}, [container]);
|
|
270
|
+
(0, _react.useEffect)(() => {
|
|
271
|
+
props.handle.api = api();
|
|
272
|
+
});
|
|
273
|
+
(0, _react.useEffect)(() => {
|
|
274
|
+
props.handle.api = api();
|
|
275
|
+
let eventHandlingConfig = {};
|
|
276
|
+
let defaultAction = {
|
|
277
|
+
actionType: 'script',
|
|
278
|
+
script: {
|
|
279
|
+
lines: [`@#{this}.highlightSelection($event.data)`]
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
eventHandlingConfig.subscriptions = [];
|
|
283
|
+
let subscription = {
|
|
284
|
+
publisher: 'propertiesGrid',
|
|
285
|
+
eventType: _EventType.default.SELECTION_CHANGE,
|
|
286
|
+
actions: [defaultAction]
|
|
287
|
+
};
|
|
288
|
+
eventHandlingConfig.subscriptions.push(subscription);
|
|
289
|
+
_Observable.default.addSubscriptions(_Utils.default.parseConfig({
|
|
290
|
+
id: props.id + "DocTemplateDesigner",
|
|
291
|
+
eventHandlingConfig
|
|
292
|
+
}, props.viewId).eventHandlingConfig, props.handle, props.viewId);
|
|
293
|
+
return () => {
|
|
294
|
+
_Observable.default.clearComponentEventListeners(props.handle);
|
|
295
|
+
};
|
|
296
|
+
}, []);
|
|
297
|
+
const doHighlightSelection = selectedPropertyRows => {
|
|
298
|
+
if (container && selectedPropertyRows && selectedPropertyRows.length > 0) {
|
|
299
|
+
container.documentEditor.selection.clear();
|
|
300
|
+
container.documentEditor.search.find(selectedPropertyRows[0].placeHolder);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
const api = () => {
|
|
304
|
+
return {
|
|
305
|
+
get id() {
|
|
306
|
+
return props.id + "DocTemplateDesigner";
|
|
307
|
+
},
|
|
308
|
+
highlightSelection: selectedPropertyRow => {
|
|
309
|
+
doHighlightSelection(selectedPropertyRow);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
314
|
+
className: 'row no-margin no-padding',
|
|
77
315
|
style: {
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
variant: "contained",
|
|
82
|
-
component: "label"
|
|
83
|
-
}, "Load Contract", /*#__PURE__*/React.createElement("input", {
|
|
84
|
-
type: "file",
|
|
316
|
+
height: "100%"
|
|
317
|
+
}
|
|
318
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
85
319
|
style: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
320
|
+
width: "40%",
|
|
321
|
+
overflow: "auto",
|
|
322
|
+
minHeight: "250px",
|
|
323
|
+
height: "100%",
|
|
324
|
+
border: "1px solid #e1e1e1",
|
|
325
|
+
borderRadius: '4px',
|
|
326
|
+
marginRight: "4px"
|
|
327
|
+
}
|
|
328
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
329
|
+
style: {
|
|
330
|
+
width: "100%",
|
|
331
|
+
fontSize: "12px",
|
|
332
|
+
backgroundColor: "#fafafa",
|
|
333
|
+
padding: "8px",
|
|
334
|
+
height: "77px",
|
|
335
|
+
color: "rgba(0, 0, 0, 0.87)",
|
|
336
|
+
borderBottom: "#f1f1f1",
|
|
337
|
+
display: "flex",
|
|
338
|
+
alignItems: "center"
|
|
339
|
+
}
|
|
340
|
+
}, "Properties"), /*#__PURE__*/React.createElement("div", {
|
|
341
|
+
style: {
|
|
342
|
+
width: "100%",
|
|
343
|
+
marginTop: "4px",
|
|
344
|
+
padding: "0 8px"
|
|
345
|
+
}
|
|
346
|
+
}, /*#__PURE__*/React.createElement(_Form.default, {
|
|
347
|
+
config: props.propertiesFormConfig,
|
|
348
|
+
handle: propertiesFormHandle.current,
|
|
349
|
+
valueChangeHandler: React.useCallback(val => {
|
|
350
|
+
model.current = val;
|
|
351
|
+
let newVal = validateProps(val.properties) ? val : null;
|
|
352
|
+
if (JSON.stringify(currentVal.current) !== JSON.stringify(newVal?.properties)) {
|
|
353
|
+
if (newVal) {
|
|
354
|
+
valueChangeHandler({
|
|
355
|
+
properties: val.properties,
|
|
356
|
+
file
|
|
357
|
+
});
|
|
358
|
+
currentVal.current = val.properties;
|
|
359
|
+
} else {
|
|
360
|
+
if (currentVal.current) {
|
|
361
|
+
currentVal.current = null;
|
|
362
|
+
valueChangeHandler(null);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, [file]),
|
|
367
|
+
viewId: props.viewId,
|
|
368
|
+
className: 'defaultForm'
|
|
369
|
+
}))), props.visible && /*#__PURE__*/React.createElement("div", {
|
|
370
|
+
className: 'col no-margin no-padding',
|
|
371
|
+
style: {
|
|
372
|
+
maxWidth: 'calc(60% - 16px)',
|
|
373
|
+
height: '100%'
|
|
374
|
+
}
|
|
375
|
+
}, /*#__PURE__*/React.createElement(_ej2ReactDocumenteditor.DocumentEditorContainerComponent, {
|
|
376
|
+
id: "container",
|
|
377
|
+
height: '590px',
|
|
92
378
|
ref: scope => {
|
|
93
|
-
|
|
379
|
+
setContainer(scope);
|
|
94
380
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
381
|
+
created: () => {
|
|
382
|
+
if (container) {
|
|
383
|
+
container.resize();
|
|
384
|
+
container.documentEditor.resize();
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
documentChange: doc => {
|
|
388
|
+
if (container) {
|
|
389
|
+
setupContainer();
|
|
390
|
+
}
|
|
391
|
+
setDoc(doc);
|
|
98
392
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
393
|
+
//documentEditorSettings={searchHighlightColor}
|
|
394
|
+
,
|
|
395
|
+
showPropertiesPane: false,
|
|
396
|
+
toolbarItems: items,
|
|
397
|
+
toolbarClick: onToolbarClick,
|
|
398
|
+
contentChange: onContentChange,
|
|
399
|
+
serviceUrl: "https://services.syncfusion.com/react/production/api/documenteditor/",
|
|
400
|
+
enableToolbar: true
|
|
401
|
+
})));
|
|
106
402
|
};
|
|
107
403
|
var _default = exports.default = DocumentTemplateDesignerComponent;
|
|
@@ -19,16 +19,16 @@ const DocumentTemplatePlaceholderDialog = _ref => {
|
|
|
19
19
|
const [selectedIndex, setSelectedIndex] = (0, _react.useState)(null);
|
|
20
20
|
const placeholders = [{
|
|
21
21
|
title: 'Placeholder 1',
|
|
22
|
-
|
|
22
|
+
value: '{{placeholder_1}}'
|
|
23
23
|
}, {
|
|
24
24
|
title: 'Placeholder 2',
|
|
25
|
-
|
|
25
|
+
value: '{{placeholder_2}}'
|
|
26
26
|
}, {
|
|
27
27
|
title: 'Placeholder 3',
|
|
28
|
-
|
|
28
|
+
value: '{{placeholder_3}}'
|
|
29
29
|
}, {
|
|
30
30
|
title: 'Placeholder 4',
|
|
31
|
-
|
|
31
|
+
value: '{{placeholder_4}}'
|
|
32
32
|
}];
|
|
33
33
|
const {
|
|
34
34
|
palette
|
|
@@ -39,7 +39,7 @@ const DocumentTemplatePlaceholderDialog = _ref => {
|
|
|
39
39
|
const handleInsert = () => {
|
|
40
40
|
if (selectedIndex !== null) {
|
|
41
41
|
console.log(`Selected placeholder: ${placeholders[selectedIndex].title}`);
|
|
42
|
-
onInsertHandler(placeholders[selectedIndex]
|
|
42
|
+
onInsertHandler(placeholders[selectedIndex]);
|
|
43
43
|
}
|
|
44
44
|
onClose();
|
|
45
45
|
};
|
|
@@ -65,7 +65,7 @@ const DocumentTemplatePlaceholderDialog = _ref => {
|
|
|
65
65
|
}
|
|
66
66
|
}, /*#__PURE__*/_react.default.createElement(_core.ListItemAvatar, null, /*#__PURE__*/_react.default.createElement(_core.Avatar, null, /*#__PURE__*/_react.default.createElement(_icons.AddCircle, null))), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
|
|
67
67
|
primary: placeholder.title,
|
|
68
|
-
secondary:
|
|
68
|
+
secondary: ''
|
|
69
69
|
})), index < placeholders.length - 1 && /*#__PURE__*/_react.default.createElement(_core.Divider, null)))))), /*#__PURE__*/_react.default.createElement(_core.DialogActions, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
70
70
|
onClick: onClose,
|
|
71
71
|
color: "primary"
|