@agilemotion/oui-react-js 1.8.56 → 1.8.58
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 +446 -472
- package/dist/BasicApp.js +30 -0
- package/dist/BasicAppHome.js +2 -3
- package/dist/DateUtils.js +2 -2
- package/dist/DynamicJS.js +93 -101
- package/dist/InteractionPortalAppHome.js +1 -1
- package/dist/InteractionPortalApp_old.js +1 -2
- package/dist/MouseTracker.js +23 -0
- package/dist/RestService.js +13 -11
- package/dist/RestUtils.js +1 -1
- package/dist/TypedValue.js +15 -14
- package/dist/Utils.js +121 -114
- package/dist/ViewContext.js +152 -159
- package/dist/assets/jss/components/authNavbarStyle.js +34 -37
- package/dist/assets/jss/components/cardHeaderStyle.js +11 -18
- package/dist/assets/jss/components/customDropdownStyle.js +25 -27
- package/dist/assets/jss/components/customInputStyle.js +7 -3
- package/dist/assets/jss/components/dropdownStyle.js +14 -11
- package/dist/assets/jss/components/footerStyle.js +17 -12
- package/dist/assets/jss/components/headerLinksStyle.js +12 -9
- package/dist/assets/jss/components/headerStyle.js +24 -26
- package/dist/assets/jss/components/navbarLinksStyle.js +12 -9
- package/dist/assets/jss/components/navbarStyle.js +24 -26
- package/dist/assets/jss/components/sidebarStyle.js +42 -42
- package/dist/assets/jss/components/typographyStyle.js +7 -3
- package/dist/assets/jss/rootStyle.js +30 -34
- package/dist/assets/jss/views/layoutStyle.js +12 -9
- package/dist/assets/jss/views/loginStyle.js +9 -6
- package/dist/components/AlertBar.js +1 -1
- package/dist/components/Button.js +18 -11
- package/dist/components/Calendar.js +9 -6
- package/dist/components/Chart.js +1 -1
- package/dist/components/DataGrid.css +12 -3
- package/dist/components/DataGrid.js +115 -56
- package/dist/components/DataGridColumn.js +22 -4
- package/dist/components/DocumentTemplateDesigner.js +9 -5
- package/dist/components/DocumentTemplateDesignerComponent.js +49 -549
- package/dist/components/DocumentTemplatePlaceholderDialog.js +3 -4
- package/dist/components/DocumentViewer.js +19 -6
- package/dist/components/ElementResizeHandler.js +177 -174
- package/dist/components/FaceApi.js +2 -2
- package/dist/components/FileThumb.js +5 -5
- package/dist/components/Graph.js +77 -74
- package/dist/components/GraphNode.js +39 -36
- package/dist/components/HtmlPanel.js +2 -1
- package/dist/components/Icon.js +1 -2
- package/dist/components/PDFViewer.js +2 -3
- package/dist/components/PopupView.js +1 -1
- package/dist/components/Portlet.js +3 -2
- package/dist/components/RegularButton.js +17 -14
- package/dist/components/SocketManager.js +97 -94
- package/dist/components/StepperTitleBar.js +7 -6
- package/dist/components/TabPage.js +10 -7
- package/dist/components/TabPanel.js +11 -6
- package/dist/components/TableCellContent.js +13 -9
- package/dist/components/TemplateDesigner.js +2 -2
- package/dist/components/TemplateItemEventHandler.js +232 -228
- package/dist/components/TemplateTable.js +32 -29
- package/dist/components/TitleBar.js +2 -2
- package/dist/components/Toolbar.js +58 -22
- package/dist/components/Tree.js +3 -3
- package/dist/components/WordDocumentViewer.css +7 -0
- package/dist/components/WordDocumentViewer.js +329 -109
- package/dist/components/card/Card.js +18 -15
- package/dist/components/card/CardAvatar.js +11 -8
- package/dist/components/card/CardBody.js +16 -13
- package/dist/components/card/CardFooter.js +15 -12
- package/dist/components/card/CardHeader.js +16 -13
- package/dist/components/card/CardIcon.js +9 -6
- package/dist/components/card/CardText.js +9 -6
- package/dist/components/customInput/File.js +4 -5
- package/dist/components/dashboard/FoldingSideTabDashboard.bck.js +1 -1
- package/dist/components/dashboard/FoldingSideTabDashboard.js +2 -3
- package/dist/components/dashboard/components/Header.js +6 -4
- package/dist/components/dashboard/components/LeftDrawer.js +2 -2
- package/dist/components/dashboard/components/blackDashboard/fixedPlugin/FixedPlugin.js +26 -28
- package/dist/components/dashboard/components/blackDashboard/sidebar/FoldingTabSidebar.bck.js +182 -188
- package/dist/components/dashboard/components/blackDashboard/sidebar/FoldingTabSidebar.js +27 -30
- package/dist/components/dashboard/components/blackDashboard/sidebar/ModuleMenuSidebar.js +12 -14
- package/dist/components/drag-spec-design.json +15 -0
- package/dist/components/facialRecognition/FaceRecognitionComponent.js +10 -11
- package/dist/components/facialRecognition/service/faceApi.js +3 -3
- package/dist/components/form/AddressSearch.js +8 -5
- package/dist/components/form/AutoComplete.js +4 -4
- package/dist/components/form/BaseField.js +3 -2
- package/dist/components/form/CurrencyField.js +8 -8
- package/dist/components/form/DatePicker.js +3 -2
- package/dist/components/form/FieldSet.js +2 -1
- package/dist/components/form/Form.css +1 -1
- package/dist/components/form/Form.js +11 -8
- package/dist/components/form/GridField.js +4 -3
- package/dist/components/form/IconField.js +2 -1
- package/dist/components/form/ImageEditor.js +13 -8
- package/dist/components/form/LookupField.js +8 -7
- package/dist/components/form/MultiFileUploadField.js +14 -8
- package/dist/components/form/SelectItem.js +7 -6
- package/dist/components/form/TextField.js +6 -6
- package/dist/components/form/TimePicker.js +3 -2
- package/dist/components/form/TransferList.js +2 -2
- package/dist/components/form/UploadField.js +5 -5
- package/dist/components/grid/GridContainer.js +7 -4
- package/dist/components/grid/GridItem.js +7 -4
- package/dist/components/layout/CollapsiblePanel.js +7 -5
- package/dist/components/layout/Layout.js +5 -5
- package/dist/components/layout/View.js +6 -5
- package/dist/components/layout/ViewContainer.js +1 -2
- package/dist/components/layout/ViewPort.js +1 -1
- package/dist/components/layout/Window.js +2 -3
- package/dist/components/layout/WindowDialog.js +9 -7
- package/dist/components/layout/WindowViewPort.js +3 -3
- package/dist/components/media/Chat.js +2 -1
- package/dist/components/media/MediaSoupHelper.js +57 -53
- package/dist/components/media/SocketRequest.js +9 -7
- package/dist/components/media/SocketResponse.js +7 -5
- package/dist/components/media/Timer.js +1 -2
- package/dist/components/media/Toolbar.js +3 -3
- package/dist/components/media/ToolbarButton.js +23 -24
- package/dist/components/media/Toolbar_bck.js +3 -3
- package/dist/components/media/Tracks.js +24 -19
- package/dist/components/media/TrainingRoom.js +3 -4
- package/dist/components/media/Transports.js +21 -17
- package/dist/components/media/VCEventManager.js +25 -24
- package/dist/components/media/VCEventType.js +81 -79
- package/dist/components/media/VCParticipantList.js +1 -2
- package/dist/components/media/VCParticipantListItem.js +2 -3
- package/dist/components/media/VCRoomParticipant.js +4 -5
- package/dist/components/media/VCRoomRecorder.js +163 -160
- package/dist/components/media/VCRoomWorkspace.js +3 -4
- package/dist/components/media/Video.js +1 -2
- package/dist/components/media/VideoPlayer.js +1 -2
- package/dist/components/media/chat/ChatPoll.js +15 -15
- package/dist/components/media/chat/ChatRoom.js +15 -15
- package/dist/components/media/chat/ChatRoomItem.js +2 -3
- package/dist/components/media/chat/ChatRoomList.js +1 -2
- package/dist/components/media/chat/ChatRoomWrapper.js +1 -1
- package/dist/components/media/chat/PollContainer.js +14 -8
- package/dist/components/media/chat/PollResult.js +1 -2
- package/dist/components/menu/MenuBars.js +8 -5
- package/dist/components/menu/MenuButton.js +11 -5
- package/dist/components/menu/MenuItem.js +13 -6
- package/dist/components/menu/MenuLink.js +2 -1
- package/dist/components/navbars/HomeNavbar.js +43 -41
- package/dist/components/navbars/PortalNavbar.js +1 -2
- package/dist/components/signatures/AgilitySignaturePanel.js +39 -15
- package/dist/components/signatures/{DocumentContainer.js → HtmlSignatureDocumentContainer.js} +4 -4
- package/dist/components/signatures/ImageSignatureInput.js +27 -16
- package/dist/components/signatures/ResponsiveTable.js +1 -1
- package/dist/components/signatures/SearchView.js +1 -1
- package/dist/components/signatures/SignatureInput.js +42 -98
- package/dist/components/signatures/SignatureInputProps.js +1 -1
- package/dist/components/signatures/SignatureTemplateDesigner.js +13 -10
- package/dist/components/signatures/Toolbar.js +7 -3
- package/dist/components/signatures/ViewUtils.js +21 -16
- package/dist/event/ActionHandlers.js +10 -7
- package/dist/event/Event.js +15 -13
- package/dist/event/EventListener.js +39 -41
- package/dist/event/EventType.js +24 -19
- package/dist/event/Observable.js +120 -125
- package/dist/event/RouteActionHandler.js +4 -4
- package/dist/event/ScriptActionHandler.js +1 -1
- package/dist/event/ServiceCallActionHandler.js +1 -1
- package/dist/interaction/CursorOverlay.js +48 -0
- package/dist/interaction/DragContext.js +39 -0
- package/dist/interaction/GrabContext.js +40 -0
- package/dist/js/Addresses.js +9 -8
- package/dist/js/Calendar.js +152 -149
- package/dist/js/Docs.js +92 -87
- package/dist/js/DynamicLib.js +9 -6
- package/dist/js/Media.js +134 -131
- package/dist/js/ProcurementMeetings.js +81 -78
- package/dist/js/Validators.js +53 -50
- package/dist/js/Windows.js +35 -32
- package/dist/redux/store/ConfigureStore.js +8 -5
- package/dist/redux/store/DashboardStore.js +13 -12
- package/dist/redux/store/SecurityStore.js +9 -6
- package/dist/security/TokenManager.js +1 -1
- package/dist/view/Dashboard.js +11 -12
- package/dist/view/security/ForgotPassword.js +3 -3
- package/dist/view/security/ForgotPasswordBasic.js +1 -1
- package/dist/view/security/Login.js +4 -4
- package/dist/view/security/LoginBasic.js +2 -2
- package/dist/view/security/LoginInteractionPortal.js +2 -2
- package/dist/view/security/ResetPassword.js +1 -1
- package/dist/view/security/ResetPasswordBasic.js +1 -1
- package/dist/view/security/Security.js +4 -4
- package/package.json +10 -10
- package/dist/components/DocumentTemplateDesignerComponent2.js +0 -585
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _ej2ReactDocumenteditor = require("@syncfusion/ej2-react-documenteditor");
|
|
8
|
-
var _ej2Base = require("@syncfusion/ej2-base");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var React = _react;
|
|
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");
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
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);
|
|
23
|
-
const DocumentTemplateDesignerComponent = props => {
|
|
24
|
-
const {
|
|
25
|
-
contractTemplate,
|
|
26
|
-
uploadTrigger,
|
|
27
|
-
valueChangeHandler,
|
|
28
|
-
addDocumentMetaDataHandler,
|
|
29
|
-
value
|
|
30
|
-
} = props;
|
|
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 [documentData, setDocumentData] = React.useState(null);
|
|
36
|
-
const [contentState] = React.useState({
|
|
37
|
-
changed: false
|
|
38
|
-
});
|
|
39
|
-
const btnRef = (0, _react.useRef)(null);
|
|
40
|
-
const currentVal = (0, _react.useRef)(null);
|
|
41
|
-
const propertiesFormHandle = React.useRef({});
|
|
42
|
-
const onToolbarClick = args => {
|
|
43
|
-
switch (args.item.id) {
|
|
44
|
-
case "Custom":
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const onWrapText = text => {
|
|
51
|
-
let content = '';
|
|
52
|
-
const index = text.lastIndexOf(' ');
|
|
53
|
-
if (index !== -1) {
|
|
54
|
-
content = text.slice(0, index) + "<div class='e-de-text-wrap'>" + text.slice(index + 1) + "</div>";
|
|
55
|
-
} else {
|
|
56
|
-
content = text;
|
|
57
|
-
}
|
|
58
|
-
return content;
|
|
59
|
-
};
|
|
60
|
-
const findNext = () => {
|
|
61
|
-
container.documentEditor.search.searchResults.index = container.documentEditor.search.searchResults.index + 1;
|
|
62
|
-
};
|
|
63
|
-
const findPrev = () => {
|
|
64
|
-
container.documentEditor.search.searchResults.index = container.documentEditor.search.searchResults.index - 1;
|
|
65
|
-
};
|
|
66
|
-
let next = {
|
|
67
|
-
prefixIcon: "e-chevron-down",
|
|
68
|
-
click: findNext.bind(void 0),
|
|
69
|
-
tooltipText: 'Next placeholder',
|
|
70
|
-
text: '',
|
|
71
|
-
id: "NextPlaceHolder"
|
|
72
|
-
};
|
|
73
|
-
let previous = {
|
|
74
|
-
prefixIcon: "e-chevron-up",
|
|
75
|
-
click: findPrev.bind(void 0),
|
|
76
|
-
tooltipText: 'Previous placeholder',
|
|
77
|
-
text: '',
|
|
78
|
-
id: "PrevPlaceHolder"
|
|
79
|
-
};
|
|
80
|
-
let apply = {
|
|
81
|
-
prefixIcon: "e-icons e-save",
|
|
82
|
-
click: applyChanges.bind(void 0),
|
|
83
|
-
tooltipText: 'Previous placeholder',
|
|
84
|
-
text: 'Apply',
|
|
85
|
-
id: "PrevPlaceHolder"
|
|
86
|
-
};
|
|
87
|
-
let items = ["Open", apply, "Undo", "Redo", "Separator", {
|
|
88
|
-
tooltipText: 'Bold',
|
|
89
|
-
prefixIcon: 'e-icons e-bold',
|
|
90
|
-
command: 'Bold'
|
|
91
|
-
}, {
|
|
92
|
-
tooltipText: 'Italic',
|
|
93
|
-
prefixIcon: 'e-icons e-italic',
|
|
94
|
-
command: 'Italic'
|
|
95
|
-
}, "Separator", "Image", "Table", "Separator", "Header", "Footer", "PageSetup", "PageNumber", "InsertFootnote", "Separator", "Find"];
|
|
96
|
-
let searchHighlightColor = {
|
|
97
|
-
searchHighlightColor: 'Red'
|
|
98
|
-
};
|
|
99
|
-
const saveDoc = () => {
|
|
100
|
-
return new Promise((accept, reject) => {
|
|
101
|
-
if (container && container.documentEditor) {
|
|
102
|
-
container.documentEditor.saveAsBlob('Docx').then(blob => {
|
|
103
|
-
accept(blob);
|
|
104
|
-
}).catch(e => {
|
|
105
|
-
console.error("Error saving document");
|
|
106
|
-
reject(e);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
const onContentChange = () => {
|
|
112
|
-
contentState.changed = true;
|
|
113
|
-
};
|
|
114
|
-
(0, _react.useEffect)(() => {
|
|
115
|
-
if (uploadTrigger != null && btnRef.current) {
|
|
116
|
-
btnRef.current.click();
|
|
117
|
-
}
|
|
118
|
-
}, [uploadTrigger]);
|
|
119
|
-
(0, _react.useEffect)(() => {
|
|
120
|
-
if (value) {
|
|
121
|
-
let i = 0;
|
|
122
|
-
for (const property of value.properties) {
|
|
123
|
-
property.id = i++;
|
|
124
|
-
}
|
|
125
|
-
propertiesFormHandle.current.api.model = {
|
|
126
|
-
properties: value.properties
|
|
127
|
-
};
|
|
128
|
-
if (value.file && value.file.url) {
|
|
129
|
-
let tokens = value.file.url.split(';base64,');
|
|
130
|
-
let type = tokens[0].replace("data:", "");
|
|
131
|
-
let base64 = tokens[1];
|
|
132
|
-
const arrayBuffer = _Utils.default.base64ToArrayBuffer(base64);
|
|
133
|
-
const file = new Blob([arrayBuffer], {
|
|
134
|
-
type
|
|
135
|
-
});
|
|
136
|
-
const formData = new FormData();
|
|
137
|
-
formData.append('files', file, 'document.docx');
|
|
138
|
-
(0, _reactPromiseTracker.trackPromise)(fetch('https://ej2services.syncfusion.com/production/web-services/api/documenteditor/Import', {
|
|
139
|
-
method: 'POST',
|
|
140
|
-
body: formData
|
|
141
|
-
}).then(response => {
|
|
142
|
-
(0, _reactPromiseTracker.trackPromise)(response.json().then(json => {
|
|
143
|
-
setDocumentData(json);
|
|
144
|
-
}));
|
|
145
|
-
}));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}, [value]);
|
|
149
|
-
const getFooterText = () => {
|
|
150
|
-
container.documentEditor.selection.goToFooter();
|
|
151
|
-
container.documentEditor.selection.selectAll();
|
|
152
|
-
let footerText = container.documentEditor.selection.getText();
|
|
153
|
-
container.documentEditor.selection.closeHeaderFooter();
|
|
154
|
-
container.documentEditor.selection.clear();
|
|
155
|
-
return footerText;
|
|
156
|
-
};
|
|
157
|
-
function applyChanges() {
|
|
158
|
-
setup();
|
|
159
|
-
}
|
|
160
|
-
function setup() {
|
|
161
|
-
let initialFormValue = {
|
|
162
|
-
properties: []
|
|
163
|
-
};
|
|
164
|
-
if (container) {
|
|
165
|
-
container.documentEditor.selection.selectAll();
|
|
166
|
-
const text = container.documentEditor.selection.getText();
|
|
167
|
-
container.documentEditor.selection.clear();
|
|
168
|
-
const bodyMatches = removeNextLineCharsFromPlaceholders(text, '<<', '>>');
|
|
169
|
-
const footerText = getFooterText();
|
|
170
|
-
let footerMatches = removeNextLineCharsFromPlaceholders(footerText, '<<', '>>');
|
|
171
|
-
const matches = bodyMatches.concat(footerMatches);
|
|
172
|
-
|
|
173
|
-
//container.documentEditor.editor.enforceProtection('password', 'CommentsOnly');
|
|
174
|
-
//container.documentEditor.search.findAll(/<<[\s\S]*?>>/g);
|
|
175
|
-
|
|
176
|
-
if (model.current.properties) {
|
|
177
|
-
matches.forEach(match => {
|
|
178
|
-
let prop = model.current.properties.find(p => p.placeHolder === match.text);
|
|
179
|
-
let indexData = {
|
|
180
|
-
start: match.start,
|
|
181
|
-
end: match.end,
|
|
182
|
-
linePositions: match.linePositions
|
|
183
|
-
};
|
|
184
|
-
if (!prop) {
|
|
185
|
-
prop = {
|
|
186
|
-
placeHolder: match.text,
|
|
187
|
-
indexes: [indexData]
|
|
188
|
-
};
|
|
189
|
-
} else {
|
|
190
|
-
if (!prop.indexes) {
|
|
191
|
-
prop.indexes = [];
|
|
192
|
-
}
|
|
193
|
-
prop.indexes.push(indexData);
|
|
194
|
-
}
|
|
195
|
-
if (!initialFormValue.properties.find(p => p.placeHolder === match.text)) {
|
|
196
|
-
initialFormValue.properties.push(prop);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
let i = 0;
|
|
200
|
-
for (const property of initialFormValue.properties) {
|
|
201
|
-
property.id = i++;
|
|
202
|
-
}
|
|
203
|
-
propertiesFormHandle.current.api.bindData(initialFormValue);
|
|
204
|
-
saveDoc().then(blob => {
|
|
205
|
-
const newFile = new File([blob], props.documentName, {
|
|
206
|
-
type: blob.type
|
|
207
|
-
});
|
|
208
|
-
setFile(newFile);
|
|
209
|
-
if (contentState.changed) {
|
|
210
|
-
if (!initialFormValue) {
|
|
211
|
-
valueChangeHandler(null);
|
|
212
|
-
} else {
|
|
213
|
-
let newVal = validateProps(initialFormValue.properties) ? {
|
|
214
|
-
properties: initialFormValue.properties,
|
|
215
|
-
file: newFile
|
|
216
|
-
} : null;
|
|
217
|
-
valueChangeHandler(newVal);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
contentState.changed = false;
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
(0, _react.useEffect)(() => {
|
|
226
|
-
setup();
|
|
227
|
-
}, [doc]);
|
|
228
|
-
(0, _react.useEffect)(() => {
|
|
229
|
-
if (container && documentData) {
|
|
230
|
-
container.documentEditor.open(JSON.stringify(documentData));
|
|
231
|
-
}
|
|
232
|
-
}, [documentData]);
|
|
233
|
-
const validateProps = properties => {
|
|
234
|
-
let valid = properties && properties.length > 0;
|
|
235
|
-
if (valid) {
|
|
236
|
-
for (const property of properties) {
|
|
237
|
-
if (!property.valueField) {
|
|
238
|
-
valid = false;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return valid;
|
|
244
|
-
};
|
|
245
|
-
const getLinePositions = (line, anchorPosition) => {
|
|
246
|
-
let linePositions = [];
|
|
247
|
-
container.documentEditor.search.find(line);
|
|
248
|
-
let searchList = container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList;
|
|
249
|
-
let startPosition = getSearchStartPosition(anchorPosition, searchList);
|
|
250
|
-
let endPosition = getSearchEndPosition(anchorPosition, searchList);
|
|
251
|
-
console.log("\n\n\n\n\n\nSEARCH LIST : ", endPosition.location.yIn);
|
|
252
|
-
console.log(endPosition);
|
|
253
|
-
for (const textSearchResult of searchList) {
|
|
254
|
-
console.log(textSearchResult.endIn.location.yIn);
|
|
255
|
-
}
|
|
256
|
-
console.log("CHECKING WORD WRAP [" + line + "] : " + startPosition.location.yIn + " - " + endPosition.location.yIn);
|
|
257
|
-
// We have a word wrap if this condition is true
|
|
258
|
-
console.log("WORD WRAP JOINT ", detectWordWrap(anchorPosition, startPosition, endPosition, container.documentEditor, line, endPosition.location.yIn));
|
|
259
|
-
if (startPosition.location.yIn < endPosition.location.yIn) {
|
|
260
|
-
linePositions.push({
|
|
261
|
-
startX: startPosition.location.xIn,
|
|
262
|
-
startY: startPosition.location.yIn,
|
|
263
|
-
endX: endPosition.location.xIn,
|
|
264
|
-
endY: endPosition.location.yIn
|
|
265
|
-
});
|
|
266
|
-
console.log("\n\n\n\n\n\nMATHATA : [" + line + "]");
|
|
267
|
-
console.log(startPosition.location.xIn + " : " + endPosition.location.xIn);
|
|
268
|
-
console.log(startPosition.location.yIn + " : " + endPosition.location.yIn);
|
|
269
|
-
} else {
|
|
270
|
-
linePositions.push({
|
|
271
|
-
startX: startPosition.location.xIn,
|
|
272
|
-
startY: startPosition.location.yIn,
|
|
273
|
-
endX: endPosition.location.xIn,
|
|
274
|
-
endY: endPosition.location.yIn
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return {
|
|
278
|
-
endPosition,
|
|
279
|
-
linePositions
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
const removeNextLineCharsFromPlaceholders = (text, startTag, endTag) => {
|
|
283
|
-
const matches = [];
|
|
284
|
-
let index = 0;
|
|
285
|
-
let anchorPosition = null;
|
|
286
|
-
while (index < text.length) {
|
|
287
|
-
const startIndex = text.indexOf(startTag, index);
|
|
288
|
-
if (startIndex === -1) break;
|
|
289
|
-
const endIndex = text.indexOf(endTag, startIndex + startTag.length);
|
|
290
|
-
if (endIndex === -1) break;
|
|
291
|
-
let find = text.substring(startIndex, endIndex + endTag.length);
|
|
292
|
-
let split = find.split("\r");
|
|
293
|
-
let linePositions = [];
|
|
294
|
-
|
|
295
|
-
//container.documentEditor.selection.start.setPositionInternal(startIndex);
|
|
296
|
-
|
|
297
|
-
if (split.length > 1) {
|
|
298
|
-
container.documentEditor.search.find(split[0]);
|
|
299
|
-
let startPosition = getSearchStartPosition(anchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
300
|
-
container.documentEditor.search.find(split[split.length - 1]);
|
|
301
|
-
let endPosition = getSearchEndPosition(anchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
302
|
-
let selection = container.documentEditor.selection;
|
|
303
|
-
selection.selectRange(startPosition, endPosition);
|
|
304
|
-
if (selection && selection.start && selection.end) {
|
|
305
|
-
let selectedText = selection.getText();
|
|
306
|
-
container.documentEditor.editor.delete();
|
|
307
|
-
container.documentEditor.editor.insertText(selectedText.replace(/(\r\n|\n|\r)/gm, ""));
|
|
308
|
-
for (const token of split) {
|
|
309
|
-
let placeholderLinePositions = getLinePositions(token, anchorPosition);
|
|
310
|
-
anchorPosition = placeholderLinePositions.endPosition;
|
|
311
|
-
linePositions.push(placeholderLinePositions.linePositions);
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
console.error("No valid selection found");
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
let placeholderLinePositions = getLinePositions(split[0], anchorPosition);
|
|
318
|
-
anchorPosition = placeholderLinePositions.endPosition;
|
|
319
|
-
linePositions.push(placeholderLinePositions.linePositions);
|
|
320
|
-
}
|
|
321
|
-
matches.push({
|
|
322
|
-
start: startIndex,
|
|
323
|
-
end: endIndex + endTag.length,
|
|
324
|
-
text: find.replace(/(\r\n|\n|\r)/gm, ""),
|
|
325
|
-
linePositions: linePositions
|
|
326
|
-
});
|
|
327
|
-
index = endIndex + endTag.length;
|
|
328
|
-
}
|
|
329
|
-
return matches;
|
|
330
|
-
};
|
|
331
|
-
const comparePositions = (a, b) => {
|
|
332
|
-
if (a.location.yIn === b.location.yIn && a.location.xIn === b.location.xIn) {
|
|
333
|
-
return 0;
|
|
334
|
-
}
|
|
335
|
-
if (a.location.yIn > b.location.yIn) {
|
|
336
|
-
return 1;
|
|
337
|
-
}
|
|
338
|
-
if (a.location.yIn < b.location.yIn) {
|
|
339
|
-
return -1;
|
|
340
|
-
}
|
|
341
|
-
if (a.location.yIn === b.location.yIn) {
|
|
342
|
-
if (a.location.xIn < b.location.xIn) {
|
|
343
|
-
return -1;
|
|
344
|
-
} else {
|
|
345
|
-
return 1;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return 0;
|
|
349
|
-
};
|
|
350
|
-
const getSearchStartPosition = (anchorPosition, searchList) => {
|
|
351
|
-
if (!anchorPosition) {
|
|
352
|
-
return searchList[0].startIn;
|
|
353
|
-
}
|
|
354
|
-
for (const searchListElement of searchList) {
|
|
355
|
-
if (comparePositions(searchListElement.startIn, anchorPosition) >= 0) {
|
|
356
|
-
return searchListElement.startIn;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return anchorPosition;
|
|
360
|
-
};
|
|
361
|
-
const getSearchEndPosition = (anchorPosition, searchList) => {
|
|
362
|
-
if (!anchorPosition) {
|
|
363
|
-
return searchList[0].endIn;
|
|
364
|
-
}
|
|
365
|
-
for (const searchListElement of searchList) {
|
|
366
|
-
if (comparePositions(searchListElement.endIn, anchorPosition) >= 0) {
|
|
367
|
-
return searchListElement.endIn;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return anchorPosition;
|
|
371
|
-
};
|
|
372
|
-
function detectWordWrap(anchorPosition, startPosition, endPosition, editor, sentence, startY) {
|
|
373
|
-
let substrings = generateSubstrings(sentence);
|
|
374
|
-
let wordWrapPositions = [];
|
|
375
|
-
let wordWrapAnchorPosition = anchorPosition;
|
|
376
|
-
|
|
377
|
-
//container.documentEditor.selection.select(startPosition, endPosition);
|
|
378
|
-
|
|
379
|
-
let prevPosition = startPosition;
|
|
380
|
-
let currentY = startY;
|
|
381
|
-
console.log("SUBSTRINGS FOR [" + sentence + "] : ", substrings);
|
|
382
|
-
console.log("ANCHOR : ", anchorPosition);
|
|
383
|
-
for (const substring of substrings) {
|
|
384
|
-
container.documentEditor.search.find(substring);
|
|
385
|
-
let endPosition = getSearchEndPosition(wordWrapAnchorPosition, container.documentEditor.search.searchResults.searchModule.textSearchResults.innerList);
|
|
386
|
-
wordWrapAnchorPosition = endPosition;
|
|
387
|
-
//container.documentEditor.selection.select(startPosition, endPosition);
|
|
388
|
-
|
|
389
|
-
console.log("[" + sentence + "] " + endPosition.location.yIn + " : " + currentY);
|
|
390
|
-
if (endPosition.location.yIn > currentY) {
|
|
391
|
-
wordWrapPositions.push({
|
|
392
|
-
prevPosition,
|
|
393
|
-
endPosition
|
|
394
|
-
});
|
|
395
|
-
currentY = endPosition.location.yIn;
|
|
396
|
-
prevPosition = endPosition;
|
|
397
|
-
}
|
|
398
|
-
console.log(substring + " - " + endPosition.location.yIn);
|
|
399
|
-
}
|
|
400
|
-
if (wordWrapPositions.length === 0) {
|
|
401
|
-
wordWrapPositions.push({
|
|
402
|
-
startPosition,
|
|
403
|
-
endPosition
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
return wordWrapPositions;
|
|
407
|
-
}
|
|
408
|
-
function generateSubstrings(sentence) {
|
|
409
|
-
let substrings = [];
|
|
410
|
-
for (let i = 0; i < sentence.length; i++) {
|
|
411
|
-
substrings.push(sentence.substring(0, i + 1)); // Add substring from index 0 to i
|
|
412
|
-
}
|
|
413
|
-
return substrings;
|
|
414
|
-
}
|
|
415
|
-
function setupContainer() {
|
|
416
|
-
container.documentEditor.currentUser = _ApplicationManager.default.getUserDetails().name + " " + _ApplicationManager.default.getUserDetails().surname;
|
|
417
|
-
}
|
|
418
|
-
(0, _react.useEffect)(() => {
|
|
419
|
-
if (container) {
|
|
420
|
-
setupContainer();
|
|
421
|
-
//autoSave();
|
|
422
|
-
|
|
423
|
-
const editor = container.documentEditor;
|
|
424
|
-
editor.addEventListener("keyDown", event => {
|
|
425
|
-
const startPosition = container.documentEditor.selection.start;
|
|
426
|
-
let selectedProperty;
|
|
427
|
-
for (const property of model.current.properties) {
|
|
428
|
-
for (const index of property.indexes) {
|
|
429
|
-
for (const linePosition of index.linePositions) {
|
|
430
|
-
console.log(property.placeHolder + "START X : " + linePosition.startX + " END X : " + linePosition.endX + " - CURSOR X : " + startPosition.location.xIn + " CURSOR Y : " + startPosition.location.yIn);
|
|
431
|
-
if (linePosition.startY === startPosition.location.yIn && linePosition.startX <= startPosition.location.xIn && linePosition.endX >= startPosition.location.xIn) {
|
|
432
|
-
console.log("PHAKATI");
|
|
433
|
-
selectedProperty = property;
|
|
434
|
-
break;
|
|
435
|
-
} else {
|
|
436
|
-
console.log("TEST 1 : " + (linePosition.startY === startPosition.location.yIn) + " TEST 2 " + (linePosition.startX <= startPosition.location.xIn) + " TEST 3 " + (linePosition.endX >= startPosition.location.xIn));
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
if (selectedProperty) {
|
|
440
|
-
break;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
if (selectedProperty) {
|
|
445
|
-
console.log("\n\n\n\n\nPREVENTING DEFAULT [" + selectedProperty.placeHolder + "]");
|
|
446
|
-
event.event.preventDefault();
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}, [container]);
|
|
451
|
-
(0, _react.useEffect)(() => {
|
|
452
|
-
props.handle.api = api();
|
|
453
|
-
});
|
|
454
|
-
(0, _react.useEffect)(() => {
|
|
455
|
-
props.handle.api = api();
|
|
456
|
-
let eventHandlingConfig = {};
|
|
457
|
-
let defaultAction = {
|
|
458
|
-
actionType: 'script',
|
|
459
|
-
script: {
|
|
460
|
-
lines: [`@#{this}.highlightSelection($event.data)`]
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
eventHandlingConfig.subscriptions = [];
|
|
464
|
-
let subscription = {
|
|
465
|
-
publisher: 'propertiesGrid',
|
|
466
|
-
eventType: _EventType.default.SELECTION_CHANGE,
|
|
467
|
-
actions: [defaultAction]
|
|
468
|
-
};
|
|
469
|
-
eventHandlingConfig.subscriptions.push(subscription);
|
|
470
|
-
_Observable.default.addSubscriptions(_Utils.default.parseConfig({
|
|
471
|
-
id: props.id + "DocTemplateDesigner",
|
|
472
|
-
eventHandlingConfig
|
|
473
|
-
}, props.viewId).eventHandlingConfig, props.handle, props.viewId);
|
|
474
|
-
return () => {
|
|
475
|
-
_Observable.default.clearComponentEventListeners(props.handle);
|
|
476
|
-
};
|
|
477
|
-
}, []);
|
|
478
|
-
const doHighlightSelection = selectedPropertyRows => {
|
|
479
|
-
if (container && selectedPropertyRows && selectedPropertyRows.length > 0) {
|
|
480
|
-
container.documentEditor.selection.clear();
|
|
481
|
-
container.documentEditor.search.find(selectedPropertyRows[0].placeHolder);
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
const api = () => {
|
|
485
|
-
return {
|
|
486
|
-
get id() {
|
|
487
|
-
return props.id + "DocTemplateDesigner";
|
|
488
|
-
},
|
|
489
|
-
highlightSelection: selectedPropertyRow => {
|
|
490
|
-
doHighlightSelection(selectedPropertyRow);
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
};
|
|
494
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
495
|
-
className: 'row no-margin no-padding',
|
|
496
|
-
style: {
|
|
497
|
-
height: "100%"
|
|
498
|
-
}
|
|
499
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
500
|
-
style: {
|
|
501
|
-
width: "40%",
|
|
502
|
-
overflow: "auto",
|
|
503
|
-
minHeight: "250px",
|
|
504
|
-
height: "100%",
|
|
505
|
-
border: "1px solid #e1e1e1",
|
|
506
|
-
borderRadius: '4px',
|
|
507
|
-
marginRight: "4px"
|
|
508
|
-
}
|
|
509
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
510
|
-
style: {
|
|
511
|
-
width: "100%",
|
|
512
|
-
fontSize: "12px",
|
|
513
|
-
backgroundColor: "#fafafa",
|
|
514
|
-
padding: "8px",
|
|
515
|
-
height: "77px",
|
|
516
|
-
color: "rgba(0, 0, 0, 0.87)",
|
|
517
|
-
borderBottom: "#f1f1f1",
|
|
518
|
-
display: "flex",
|
|
519
|
-
alignItems: "center"
|
|
520
|
-
}
|
|
521
|
-
}, "Properties"), /*#__PURE__*/React.createElement("div", {
|
|
522
|
-
style: {
|
|
523
|
-
width: "100%",
|
|
524
|
-
marginTop: "4px",
|
|
525
|
-
padding: "0 8px"
|
|
526
|
-
}
|
|
527
|
-
}, /*#__PURE__*/React.createElement(_Form.default, {
|
|
528
|
-
config: props.propertiesFormConfig,
|
|
529
|
-
handle: propertiesFormHandle.current,
|
|
530
|
-
valueChangeHandler: React.useCallback(val => {
|
|
531
|
-
model.current = val;
|
|
532
|
-
let newVal = validateProps(val.properties) ? val : null;
|
|
533
|
-
if (JSON.stringify(currentVal.current) !== JSON.stringify(newVal?.properties)) {
|
|
534
|
-
if (newVal) {
|
|
535
|
-
valueChangeHandler({
|
|
536
|
-
properties: val.properties,
|
|
537
|
-
file
|
|
538
|
-
});
|
|
539
|
-
currentVal.current = val.properties;
|
|
540
|
-
} else {
|
|
541
|
-
if (currentVal.current) {
|
|
542
|
-
currentVal.current = null;
|
|
543
|
-
valueChangeHandler(null);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}, [file]),
|
|
548
|
-
viewId: props.viewId,
|
|
549
|
-
className: 'defaultForm'
|
|
550
|
-
}))), props.visible && /*#__PURE__*/React.createElement("div", {
|
|
551
|
-
className: 'col no-margin no-padding',
|
|
552
|
-
style: {
|
|
553
|
-
maxWidth: 'calc(60% - 16px)',
|
|
554
|
-
height: '100%'
|
|
555
|
-
}
|
|
556
|
-
}, /*#__PURE__*/React.createElement(_ej2ReactDocumenteditor.DocumentEditorContainerComponent, {
|
|
557
|
-
id: "container",
|
|
558
|
-
height: '590px',
|
|
559
|
-
ref: scope => {
|
|
560
|
-
setContainer(scope);
|
|
561
|
-
},
|
|
562
|
-
created: () => {
|
|
563
|
-
if (container) {
|
|
564
|
-
container.resize();
|
|
565
|
-
container.documentEditor.resize();
|
|
566
|
-
}
|
|
567
|
-
},
|
|
568
|
-
documentChange: doc => {
|
|
569
|
-
if (container) {
|
|
570
|
-
setupContainer();
|
|
571
|
-
}
|
|
572
|
-
setDoc(doc);
|
|
573
|
-
}
|
|
574
|
-
//documentEditorSettings={searchHighlightColor}
|
|
575
|
-
,
|
|
576
|
-
showPropertiesPane: false,
|
|
577
|
-
enableTrackChanges: false,
|
|
578
|
-
toolbarItems: items,
|
|
579
|
-
toolbarClick: onToolbarClick,
|
|
580
|
-
contentChange: onContentChange,
|
|
581
|
-
serviceUrl: "https://services.syncfusion.com/react/production/api/documenteditor/",
|
|
582
|
-
enableToolbar: true
|
|
583
|
-
})));
|
|
584
|
-
};
|
|
585
|
-
var _default = exports.default = DocumentTemplateDesignerComponent;
|