@agilemotion/oui-react-js 1.3.1 → 1.3.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/ApplicationContext.js +148 -39
- package/dist/BasicApp.js +12 -5
- package/dist/BasicAppHome.js +18 -12
- package/dist/BusinessPortalApp.css +37 -0
- package/dist/BusinessPortalApp.js +90 -0
- package/dist/BusinessPortalAppHome.js +160 -0
- package/dist/RestUtils.js +65 -40
- package/dist/Utils.js +47 -1
- package/dist/assets/jss/components/footerStyle.js +7 -4
- package/dist/assets/jss/views/loginBasicStyle.js +0 -1
- package/dist/assets/jss/views/loginBusinessPortalStyle.js +76 -0
- package/dist/components/AlertBar.js +40 -11
- package/dist/components/ConfirmationDialog.js +54 -8
- package/dist/components/DataGrid.css +3 -1
- package/dist/components/DataGrid.js +149 -82
- package/dist/components/DataGridFilter.js +85 -8
- package/dist/components/Dialog.js +258 -0
- package/dist/components/Graph.js +26 -18
- package/dist/components/GraphNode.js +0 -2
- package/dist/components/HtmlPanel.js +103 -4
- package/dist/components/Icon.js +60 -0
- package/dist/components/PopupView.js +55 -6
- package/dist/components/SignaturePanel.js +147 -0
- package/dist/components/StepperTitleBar.bck.css +85 -0
- package/dist/components/StepperTitleBar.css +53 -54
- package/dist/components/StepperTitleBar.js +42 -29
- package/dist/components/TabPanel.js +10 -11
- package/dist/components/TableCellContent.js +6 -3
- package/dist/components/TemplateDesigner.css +13 -0
- package/dist/components/TemplateDesigner.js +494 -0
- package/dist/components/TemplateItemEventHandler.js +440 -0
- package/dist/components/TemplateTable.js +222 -0
- package/dist/components/TitleBar.js +21 -14
- package/dist/components/Toolbar.js +7 -5
- package/dist/components/Tree.js +5 -2
- package/dist/components/dashboard/{BasicBusinessApp.js → BasicBusinessAppDashboard.js} +30 -25
- package/dist/components/dashboard/BusinessPortalAppDashboard.css +5 -0
- package/dist/components/dashboard/BusinessPortalAppDashboard.js +236 -0
- package/dist/components/dashboard/components/blackDashboard/sidebar/Sidebar.js +23 -12
- package/dist/components/dashboard/components/portal/Timeline.js +17 -0
- package/dist/components/dashboard/components/portal/Workspace.css +25 -0
- package/dist/components/dashboard/components/portal/Workspace.js +48 -0
- package/dist/components/dashboard/components/portal/portal-dashboard.css +25 -0
- package/dist/components/footer/Footer.js +43 -10
- package/dist/components/form/AddressSearch.js +140 -0
- package/dist/components/form/BaseField.js +42 -8
- package/dist/components/form/Checkbox.js +3 -0
- package/dist/components/form/DatePicker.js +70 -4
- package/dist/components/form/FieldSet.js +247 -72
- package/dist/components/form/Form.js +178 -127
- package/dist/components/form/GridField.js +3 -2
- package/dist/components/form/ImageEditor.js +461 -0
- package/dist/components/form/LabelField.js +2 -2
- package/dist/components/form/LookupField.js +16 -4
- package/dist/components/form/RadioGroup.js +107 -0
- package/dist/components/form/Section.js +58 -19
- package/dist/components/form/SelectItem.js +14 -5
- package/dist/components/form/SignatureTemplateDesignerField.js +46 -0
- package/dist/components/form/TextField.js +5 -9
- package/dist/components/form/TransferList.js +7 -7
- package/dist/components/form/UploadField.js +184 -55
- package/dist/components/form/noimage-person.png +0 -0
- package/dist/components/form/noimage.png +0 -0
- package/dist/components/form/transparent.jpeg +0 -0
- package/dist/components/layout/CollapsiblePanel.js +0 -6
- package/dist/components/layout/Layout.js +49 -19
- package/dist/components/layout/View.css +43 -0
- package/dist/components/layout/View.js +76 -156
- package/dist/components/layout/ViewPort.js +32 -49
- package/dist/components/menu/MenuLink.js +7 -0
- package/dist/components/navbars/HomeNavbar.js +29 -14
- package/dist/components/navbars/PortalNavbar.css +75 -0
- package/dist/components/navbars/PortalNavbar.js +227 -0
- package/dist/components/signatures/AgilitySignaturePanel.js +312 -0
- package/dist/components/signatures/DocumentContainer.css +33 -0
- package/dist/components/signatures/DocumentContainer.js +206 -0
- package/dist/components/signatures/ImageSignatureInput.js +265 -0
- package/dist/components/signatures/ResponsiveTable.js +1 -3
- package/dist/components/signatures/SignatureInput.js +303 -0
- package/dist/components/signatures/SignatureInputProps.js +17 -11
- package/dist/components/signatures/SignatureTemplateDesigner.js +192 -81
- package/dist/components/signatures/transparent.jpeg +0 -0
- package/dist/event/LoadDataActionHandler.js +1 -1
- package/dist/event/Observable.js +1 -1
- package/dist/event/RouteActionHandler.js +18 -5
- package/dist/event/ServiceCallActionHandler.js +7 -3
- package/dist/js/Addresses.js +16 -9
- package/dist/view/Dashboard.js +27 -19
- package/dist/view/PortalDashboard.js +33 -0
- package/dist/view/security/ChangePasswordBasic.js +1 -0
- package/dist/view/security/ForgotPasswordBasic.js +1 -0
- package/dist/view/security/LoginBasic.js +6 -1
- package/dist/view/security/LoginBusinessPortal.js +268 -0
- package/dist/view/security/ResetPasswordBasic.js +1 -0
- package/package.json +25 -21
- package/dist/assets/img/flogo.png +0 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _TemplateTable = _interopRequireDefault(require("./TemplateTable"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
20
|
+
const parse = val => {
|
|
21
|
+
return parseFloat(val.replace('px', ''));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const boundCheck = (pos, mousePos) => {
|
|
25
|
+
return pos - 8 < mousePos && pos + 8 > mousePos;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
class TemplateItemEventHandler {
|
|
29
|
+
constructor() {
|
|
30
|
+
_defineProperty(this, "dragStart", event => {
|
|
31
|
+
if (this.selectedNode === event.target) {
|
|
32
|
+
if (document.body.style.cursor !== "move" || this.resizingTableColumn) {
|
|
33
|
+
if (!this.resizingTableColumn || this.resizingBoundaryTableColumn) {
|
|
34
|
+
this.currentResizeNode = event.target;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let parentLeft = event.target.parentElement.offsetLeft;
|
|
41
|
+
let parentTop = event.target.parentElement.offsetTop;
|
|
42
|
+
this.dragOffset.x = event.clientX - (parentLeft + parseFloat(event.target.style.left.replace('px', '')));
|
|
43
|
+
this.dragOffset.y = event.clientY - (parentTop + parseFloat(event.target.style.top.replace('px', '')));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
_defineProperty(this, "dragOver", event => {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "initDragAndDrop", () => {
|
|
52
|
+
this.dragOffset = {};
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
let elements = document.getElementsByClassName("dropTarget");
|
|
55
|
+
|
|
56
|
+
var _iterator = _createForOfIteratorHelper(elements),
|
|
57
|
+
_step;
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
61
|
+
const element = _step.value;
|
|
62
|
+
element.addEventListener("dragstart", this.dragStart, false);
|
|
63
|
+
element.addEventListener("dragover", this.dragOver, false);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
_iterator.e(err);
|
|
67
|
+
} finally {
|
|
68
|
+
_iterator.f();
|
|
69
|
+
}
|
|
70
|
+
}, 2000);
|
|
71
|
+
document.addEventListener("mousedown", this.handleMouseDown);
|
|
72
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
73
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "handleMouseMove", event => {
|
|
77
|
+
this.resizeNode(event, this.currentResizeNode);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
_defineProperty(this, "handleMouseDown", event => {
|
|
81
|
+
this.mouseDown = true;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
_defineProperty(this, "handleMouseUp", event => {
|
|
85
|
+
this.mouseDown = false;
|
|
86
|
+
this.currentResizeNode = null;
|
|
87
|
+
document.body.style.cursor = "default";
|
|
88
|
+
|
|
89
|
+
if (typeof event.target.className === 'string' && event.target.className !== '_draggable_' && !event.target.className.startsWith('_item_table')) {
|
|
90
|
+
this.resetBorders();
|
|
91
|
+
this.selectedNode = null;
|
|
92
|
+
this.selectedNodeInitPosition = null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.tableItemPreResizeWidth = null;
|
|
96
|
+
this.tableItemPreResizeHeight = null;
|
|
97
|
+
this.lastColItemPreResizeWidth = null;
|
|
98
|
+
this.firstColItemPreResizeWidth = null;
|
|
99
|
+
this.firstRowItemPreResizeHeight = null;
|
|
100
|
+
this.resizingTableColumn = false;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
_defineProperty(this, "handleGrabRelease", (event, props, selectionHandler) => {
|
|
104
|
+
let width = props.width;
|
|
105
|
+
let height = props.height;
|
|
106
|
+
let parent = event.target;
|
|
107
|
+
let dropTarget = null;
|
|
108
|
+
|
|
109
|
+
while (parent) {
|
|
110
|
+
if (parent.className === 'dropTarget') {
|
|
111
|
+
dropTarget = parent;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
parent = parent.parentElement;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (dropTarget) {
|
|
119
|
+
let container = document.getElementById('templateContainer');
|
|
120
|
+
let node = document.createElement("div");
|
|
121
|
+
node.id = props.id;
|
|
122
|
+
node.style.lineHeight = event.target.style.lineHeight;
|
|
123
|
+
node.style.left = event.clientX - dropTarget.offsetLeft + 'px';
|
|
124
|
+
node.style.top = container.scrollTop + event.clientY - dropTarget.offsetTop + 'px';
|
|
125
|
+
node.style.border = '2px dashed green';
|
|
126
|
+
node.className = "_draggable_";
|
|
127
|
+
node.setAttribute("draggable", true);
|
|
128
|
+
|
|
129
|
+
if (props.type === 'TABLE') {
|
|
130
|
+
let table = new _TemplateTable.default(props.table, node).build((resizing, boundary) => {
|
|
131
|
+
this.resizingTableColumn = resizing;
|
|
132
|
+
this.resizingBoundaryTableColumn = boundary;
|
|
133
|
+
}, parent => {
|
|
134
|
+
return this.selectedNode === parent;
|
|
135
|
+
});
|
|
136
|
+
node.appendChild(table);
|
|
137
|
+
node.style.padding = '1px';
|
|
138
|
+
node.style.width = parse(table.style.width) + 2 + 'px';
|
|
139
|
+
node.style.height = parse(table.style.height) + 2 + 'px';
|
|
140
|
+
} else {
|
|
141
|
+
node.style.height = height + 'px';
|
|
142
|
+
node.style.width = width + 'px';
|
|
143
|
+
node.innerText = props.description;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
node.addEventListener('dragend', event => this.handleItemDrop(event, dropTarget), false);
|
|
147
|
+
let placeHolders = dropTarget.getElementsByClassName('__sys_placeholders')[0];
|
|
148
|
+
node.addEventListener('mousemove', event => this.handleItemMouseMove(event, placeHolders), false);
|
|
149
|
+
node.addEventListener('mouseout', this.handleItemMouseOut, false);
|
|
150
|
+
node.addEventListener('mouseup', event => this.handleItemMouseClick(node, props.id, selectionHandler), false);
|
|
151
|
+
placeHolders.appendChild(node);
|
|
152
|
+
this.selectedNode = node;
|
|
153
|
+
this.setSelectedInitNodePos();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (typeof event.target.className === 'string' && !event.target.className.includes("paletteButton") && !event.target.className.includes("paletteButtonLabel") && !event.target.className.includes("paletteButtonSelected")) {
|
|
157
|
+
document.getElementsByTagName("body")[0].style.cursor = 'default';
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
_defineProperty(this, "handleItemDrop", (event, target) => {
|
|
162
|
+
event.target.style.left = event.clientX - target.offsetLeft - this.dragOffset.x + 'px';
|
|
163
|
+
event.target.style.top = event.clientY - target.offsetTop - this.dragOffset.y + 'px';
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
this.currentResizeNode = null;
|
|
166
|
+
this.mouseDown = false;
|
|
167
|
+
document.body.style.cursor = "default";
|
|
168
|
+
this.resetBorders();
|
|
169
|
+
event.target.style.border = '2px dashed green';
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
_defineProperty(this, "resizeNode", (event, node) => {
|
|
173
|
+
//console.log(this.mouseDown + " : " + node + " : " + this.resizingTableColumn);
|
|
174
|
+
if (this.mouseDown && node) {
|
|
175
|
+
let container = document.getElementById('templateContainer');
|
|
176
|
+
let mouseX = event.clientX - this.resizingItemParent.offsetLeft + container.scrollLeft;
|
|
177
|
+
let mouseY = event.clientY - this.resizingItemParent.offsetTop + container.scrollTop;
|
|
178
|
+
let resizeSpec = {
|
|
179
|
+
leftOffset: 0,
|
|
180
|
+
rightOffset: 0,
|
|
181
|
+
topOffset: 0,
|
|
182
|
+
bottomOffset: 0
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
if (this.boundCheckLeft) {
|
|
186
|
+
let widthDiff = mouseX - parse(node.style.left);
|
|
187
|
+
let newWidth = parse(node.style.width) - widthDiff; //console.log("\n\n\n SETTING SPEC LEFT : " + this.selectedNodeInitPosition.left);
|
|
188
|
+
|
|
189
|
+
resizeSpec.leftOffset = mouseX - this.selectedNodeInitPosition.left;
|
|
190
|
+
|
|
191
|
+
if (newWidth >= 20) {
|
|
192
|
+
node.style.width = newWidth + 'px';
|
|
193
|
+
node.style.left = mouseX + 'px';
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (this.boundCheckRight) {
|
|
198
|
+
let newWidth = mouseX - parse(node.style.left);
|
|
199
|
+
resizeSpec.rightOffset = newWidth - this.selectedNodeInitPosition.width;
|
|
200
|
+
|
|
201
|
+
if (newWidth >= 20) {
|
|
202
|
+
node.style.width = newWidth + 'px';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (this.boundCheckTop) {
|
|
207
|
+
let heightDiff = mouseY - parse(node.style.top);
|
|
208
|
+
let newHeight = parse(node.style.height) - heightDiff;
|
|
209
|
+
resizeSpec.topOffset = mouseY - this.selectedNodeInitPosition.top;
|
|
210
|
+
|
|
211
|
+
if (newHeight >= 20) {
|
|
212
|
+
node.style.height = newHeight + 'px';
|
|
213
|
+
node.style.top = mouseY + 'px';
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
resizeSpec.topResized = true;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (this.boundCheckBottom) {
|
|
220
|
+
let newHeight = mouseY - parse(node.style.top);
|
|
221
|
+
resizeSpec.bottomOffset = newHeight - this.selectedNodeInitPosition.height;
|
|
222
|
+
|
|
223
|
+
if (newHeight >= 20) {
|
|
224
|
+
node.style.height = newHeight + 'px';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
resizeSpec.bottomResized = true;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
this.resizeTables(node, resizeSpec);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
_defineProperty(this, "updateCursor", (node, event, itemParent) => {
|
|
235
|
+
if (!this.mouseDown && this.selectedNode) {
|
|
236
|
+
let container = document.getElementById('templateContainer');
|
|
237
|
+
let left = parse(node.style.left) + container.offsetLeft;
|
|
238
|
+
let right = left + parse(node.style.width);
|
|
239
|
+
let top = parse(node.style.top) + itemParent.offsetTop;
|
|
240
|
+
let bottom = top + parse(node.style.height);
|
|
241
|
+
let mouseX = event.clientX + container.scrollLeft;
|
|
242
|
+
let mouseY = event.clientY + container.scrollTop;
|
|
243
|
+
this.boundCheckTop = boundCheck(top, mouseY);
|
|
244
|
+
this.boundCheckLeft = boundCheck(left, mouseX);
|
|
245
|
+
this.boundCheckRight = boundCheck(right, mouseX);
|
|
246
|
+
this.boundCheckBottom = boundCheck(bottom, mouseY);
|
|
247
|
+
|
|
248
|
+
if (this.boundCheckTop && this.boundCheckLeft || this.boundCheckBottom && this.boundCheckRight) {
|
|
249
|
+
document.body.style.cursor = "nwse-resize";
|
|
250
|
+
} else if (this.boundCheckTop && this.boundCheckRight || this.boundCheckBottom && this.boundCheckLeft) {
|
|
251
|
+
document.body.style.cursor = "nesw-resize";
|
|
252
|
+
} else if (this.boundCheckTop || this.boundCheckBottom) {
|
|
253
|
+
document.body.style.cursor = "ns-resize";
|
|
254
|
+
} else if (this.boundCheckLeft || this.boundCheckRight) {
|
|
255
|
+
document.body.style.cursor = "ew-resize";
|
|
256
|
+
} else {
|
|
257
|
+
document.body.style.cursor = "move";
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
this.resizingItemParent = itemParent;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
_defineProperty(this, "resetBorders", () => {
|
|
265
|
+
let items = document.getElementsByClassName("_draggable_");
|
|
266
|
+
|
|
267
|
+
var _iterator2 = _createForOfIteratorHelper(items),
|
|
268
|
+
_step2;
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
272
|
+
const item = _step2.value;
|
|
273
|
+
item.style.border = 'none';
|
|
274
|
+
}
|
|
275
|
+
} catch (err) {
|
|
276
|
+
_iterator2.e(err);
|
|
277
|
+
} finally {
|
|
278
|
+
_iterator2.f();
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
_defineProperty(this, "handleItemMouseOut", event => {
|
|
283
|
+
if (!this.currentResizeNode) {
|
|
284
|
+
document.body.style.cursor = "default";
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
_defineProperty(this, "handleItemMouseMove", (event, itemParent) => {
|
|
289
|
+
let node = event.target;
|
|
290
|
+
this.updateCursor(node, event, itemParent);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
_defineProperty(this, "handleItemMouseClick", (node, id, selectionHandler) => {
|
|
294
|
+
this.resetBorders();
|
|
295
|
+
node.style.border = '2px dashed green';
|
|
296
|
+
this.selectedNode = node;
|
|
297
|
+
this.setSelectedInitNodePos();
|
|
298
|
+
selectionHandler(id);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
resizeTables(node, spec) {
|
|
303
|
+
let tables = node.getElementsByClassName('_item_table');
|
|
304
|
+
let table = tables && tables.length > 0 ? tables[0] : null;
|
|
305
|
+
|
|
306
|
+
if (!this.tableItemPreResizeWidth && table) {
|
|
307
|
+
this.tableItemPreResizeWidth = parse(table.style.width);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (!this.tableItemPreResizeHeight && table) {
|
|
311
|
+
this.tableItemPreResizeHeight = parse(table.style.height);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (table) {
|
|
315
|
+
if (spec.rightOffset !== 0) {
|
|
316
|
+
let numCols = table['data-num-cols'];
|
|
317
|
+
let lastCols = node.getElementsByClassName("_item_table_col_".concat(numCols - 1));
|
|
318
|
+
let newWidth;
|
|
319
|
+
let resized = true;
|
|
320
|
+
|
|
321
|
+
var _iterator3 = _createForOfIteratorHelper(lastCols),
|
|
322
|
+
_step3;
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
326
|
+
const lastCol = _step3.value;
|
|
327
|
+
|
|
328
|
+
if (!this.lastColItemPreResizeWidth) {
|
|
329
|
+
this.lastColItemPreResizeWidth = parse(lastCol.style.width);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
newWidth = this.lastColItemPreResizeWidth + spec.rightOffset; //console.log(spec.leftOffset + " : " + spec.rightOffset + " : " + this.lastColItemPreResizeWidth);
|
|
333
|
+
|
|
334
|
+
if (newWidth >= 32) {
|
|
335
|
+
lastCol.style.width = newWidth + 'px';
|
|
336
|
+
} else {
|
|
337
|
+
resized = false;
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
} catch (err) {
|
|
342
|
+
_iterator3.e(err);
|
|
343
|
+
} finally {
|
|
344
|
+
_iterator3.f();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (resized) {
|
|
348
|
+
table.style.width = this.tableItemPreResizeWidth + spec.rightOffset + 'px';
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (spec.leftOffset !== 0) {
|
|
353
|
+
let newWidth;
|
|
354
|
+
let firstCols = node.getElementsByClassName('_item_table_col_0');
|
|
355
|
+
let resized = true;
|
|
356
|
+
|
|
357
|
+
var _iterator4 = _createForOfIteratorHelper(firstCols),
|
|
358
|
+
_step4;
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
362
|
+
const firstCol = _step4.value;
|
|
363
|
+
|
|
364
|
+
if (!this.firstColItemPreResizeWidth) {
|
|
365
|
+
this.firstColItemPreResizeWidth = parse(firstCol.style.width);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
newWidth = this.firstColItemPreResizeWidth + spec.leftOffset * -1;
|
|
369
|
+
|
|
370
|
+
if (newWidth >= 32) {
|
|
371
|
+
firstCol.style.width = newWidth + 'px';
|
|
372
|
+
} else {
|
|
373
|
+
resized = false;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
_iterator4.e(err);
|
|
379
|
+
} finally {
|
|
380
|
+
_iterator4.f();
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (resized) {
|
|
384
|
+
table.style.width = this.tableItemPreResizeWidth + spec.leftOffset * -1 + 'px';
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (spec.topOffset !== 0 || spec.bottomOffset !== 0) {
|
|
389
|
+
let newHeight;
|
|
390
|
+
let rows = node.getElementsByClassName('_item_table_tr');
|
|
391
|
+
|
|
392
|
+
if (!this.firstRowItemPreResizeHeight) {
|
|
393
|
+
this.firstRowItemPreResizeHeight = parse(rows[0].style.height);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (spec.topOffset !== 0) {
|
|
397
|
+
newHeight = this.firstRowItemPreResizeHeight - spec.topOffset / rows.length;
|
|
398
|
+
} else if (spec.bottomOffset !== 0) {
|
|
399
|
+
newHeight = this.firstRowItemPreResizeHeight + spec.bottomOffset / rows.length;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
var _iterator5 = _createForOfIteratorHelper(rows),
|
|
403
|
+
_step5;
|
|
404
|
+
|
|
405
|
+
try {
|
|
406
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
407
|
+
const row = _step5.value;
|
|
408
|
+
row.style.height = newHeight + 'px';
|
|
409
|
+
}
|
|
410
|
+
} catch (err) {
|
|
411
|
+
_iterator5.e(err);
|
|
412
|
+
} finally {
|
|
413
|
+
_iterator5.f();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (spec.topOffset !== 0) {
|
|
417
|
+
table.style.height = this.tableItemPreResizeHeight - spec.topOffset + 'px';
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (spec.bottomOffset !== 0) {
|
|
421
|
+
table.style.height = this.tableItemPreResizeHeight + spec.bottomOffset + 'px';
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
table.style.height = this.tableItemPreResizeHeight + (spec.topOffset !== 0 ? spec.topOffset : spec.bottomOffset) + 'px';
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
setSelectedInitNodePos() {
|
|
430
|
+
this.selectedNodeInitPosition = {
|
|
431
|
+
top: parse(this.selectedNode.style.top),
|
|
432
|
+
left: parse(this.selectedNode.style.left),
|
|
433
|
+
width: parse(this.selectedNode.style.width),
|
|
434
|
+
height: parse(this.selectedNode.style.height)
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
exports.default = TemplateItemEventHandler;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
|
|
14
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
|
|
16
|
+
const boundCheck = (pos, mousePos) => {
|
|
17
|
+
return pos - 8 < mousePos && pos + 8 > mousePos;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const parse = val => {
|
|
21
|
+
return parseFloat(val.replace('px', ''));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const DEFAULT_COL_WIDTH = 32;
|
|
25
|
+
|
|
26
|
+
class TemplateTable {
|
|
27
|
+
constructor(config, parent) {
|
|
28
|
+
_defineProperty(this, "handleMouseMove", event => {
|
|
29
|
+
if (this.currentResizeCol && this.mouseDown) {}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
_defineProperty(this, "getElementWidth", el => {
|
|
33
|
+
return el ? parseFloat(el.style.width.replace("px", "")) : null;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
_defineProperty(this, "build", (colResizeHandler, parentSelectionChecker) => {
|
|
37
|
+
let tableConfig = this.config;
|
|
38
|
+
let tableHeight = tableConfig.defaultRowHeight * tableConfig.defaultNumRows;
|
|
39
|
+
let tableWidth = 0;
|
|
40
|
+
|
|
41
|
+
var _iterator = _createForOfIteratorHelper(tableConfig.columns),
|
|
42
|
+
_step;
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
46
|
+
const column = _step.value;
|
|
47
|
+
tableWidth += column.defaultWidth;
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
_iterator.e(err);
|
|
51
|
+
} finally {
|
|
52
|
+
_iterator.f();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let table = document.createElement("div");
|
|
56
|
+
table['data-num-cols'] = tableConfig.columns.length;
|
|
57
|
+
table.className = '_item_table';
|
|
58
|
+
table.style.border = '1px solid #aaa';
|
|
59
|
+
table.style.width = tableWidth + 'px';
|
|
60
|
+
table.style.height = tableHeight + 'px';
|
|
61
|
+
let sortedCols = tableConfig.columns.sort((a, b) => a.id - b.id);
|
|
62
|
+
|
|
63
|
+
for (let i = 0; i < tableConfig.defaultNumRows; i++) {
|
|
64
|
+
table.appendChild(this.createRow(tableConfig, sortedCols, tableWidth, i, colResizeHandler, parentSelectionChecker));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return table;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
this.config = config;
|
|
71
|
+
this.parent = parent;
|
|
72
|
+
|
|
73
|
+
const _this = this;
|
|
74
|
+
|
|
75
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
76
|
+
document.addEventListener("mousedown", e => this.mouseDown = true);
|
|
77
|
+
document.addEventListener('mouseup', function (e) {
|
|
78
|
+
_this.currentClientX = null;
|
|
79
|
+
_this.curResizeColWidth = null;
|
|
80
|
+
_this.curResizeNxtColWidth = null;
|
|
81
|
+
_this.mouseDown = false;
|
|
82
|
+
|
|
83
|
+
_this.setResizingBorderWidth('1px');
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
addColMouseMoveEvent(col, colResizeHandler, parentSelectionChecker, first, last) {
|
|
88
|
+
col.addEventListener("mousemove", e => {
|
|
89
|
+
const _this = this;
|
|
90
|
+
|
|
91
|
+
let parentOffset = this.parent.offsetLeft + this.parent.parentElement.offsetLeft;
|
|
92
|
+
|
|
93
|
+
if (boundCheck(parentOffset + e.target.offsetLeft + parse(e.target.style.width), e.clientX)) {
|
|
94
|
+
if (parentSelectionChecker(this.parent)) {
|
|
95
|
+
e.target.style.cursor = 'ew-resize';
|
|
96
|
+
this.currentResizeCol = e.target;
|
|
97
|
+
colResizeHandler(true, last || first);
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
if (!this.mouseDown) {
|
|
101
|
+
e.target.style.cursor = 'default';
|
|
102
|
+
this.currentResizeCol = null;
|
|
103
|
+
colResizeHandler(false, last || first);
|
|
104
|
+
}
|
|
105
|
+
} //console.log(this.currentResizeCol + " : " + this.mouseDown + " : " + this.currentClientX + " : " + this.curResizeNxtColWidth);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if (this.currentResizeCol && this.mouseDown && this.currentClientX && this.curResizeNxtColWidth) {
|
|
109
|
+
let diffX = e.clientX - _this.currentClientX;
|
|
110
|
+
let width = _this.curResizeColWidth + diffX;
|
|
111
|
+
let nextWidth = _this.curResizeNxtColWidth - diffX;
|
|
112
|
+
let index = this.currentResizeCol['data-index'];
|
|
113
|
+
|
|
114
|
+
if (width >= DEFAULT_COL_WIDTH && nextWidth >= DEFAULT_COL_WIDTH) {
|
|
115
|
+
//console.log(width + " : " + nextWidth + " : " + DEFAULT_COL_WIDTH);
|
|
116
|
+
this.resizeColumn(index, width);
|
|
117
|
+
this.resizeColumn(index + 1, nextWidth);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
resizeColumn(index, width) {
|
|
124
|
+
let elements = this.currentResizeCol.parentElement.parentElement.getElementsByClassName("_item_table_col_".concat(index));
|
|
125
|
+
|
|
126
|
+
if (elements && elements.length > 0) {
|
|
127
|
+
var _iterator2 = _createForOfIteratorHelper(elements),
|
|
128
|
+
_step2;
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
132
|
+
const element = _step2.value;
|
|
133
|
+
element.style.width = width + 'px';
|
|
134
|
+
}
|
|
135
|
+
} catch (err) {
|
|
136
|
+
_iterator2.e(err);
|
|
137
|
+
} finally {
|
|
138
|
+
_iterator2.f();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
setResizingBorderWidth(width) {
|
|
144
|
+
if (this.currentResizeCol) {
|
|
145
|
+
this.currentResizeCol.style.borderWidth = width;
|
|
146
|
+
let index = this.currentResizeCol['data-index'];
|
|
147
|
+
let elements = this.currentResizeCol.parentElement.parentElement.getElementsByClassName("_item_table_col_".concat(index));
|
|
148
|
+
|
|
149
|
+
if (elements && elements.length > 0) {
|
|
150
|
+
var _iterator3 = _createForOfIteratorHelper(elements),
|
|
151
|
+
_step3;
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
155
|
+
const element = _step3.value;
|
|
156
|
+
element.style.borderWidth = width;
|
|
157
|
+
}
|
|
158
|
+
} catch (err) {
|
|
159
|
+
_iterator3.e(err);
|
|
160
|
+
} finally {
|
|
161
|
+
_iterator3.f();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
createRow(tableConfig, cols, tableWidth, index, colResizeHandler, parentSelectionChecker) {
|
|
168
|
+
let row = document.createElement("div");
|
|
169
|
+
row.className = '_item_table_tr row';
|
|
170
|
+
row.style.width = '100%';
|
|
171
|
+
row.style.margin = '0';
|
|
172
|
+
row.style.height = tableConfig.defaultRowHeight + 'px';
|
|
173
|
+
let last = tableConfig.defaultNumRows.length - 1 === index;
|
|
174
|
+
|
|
175
|
+
if (!last) {
|
|
176
|
+
row.style.borderBottom = '1px solid #aaa';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
for (let i = 0; i < cols.length; i++) {
|
|
180
|
+
let col = cols[i];
|
|
181
|
+
let colEl = document.createElement("div");
|
|
182
|
+
colEl.style.width = col.defaultWidth - 1 + 'px';
|
|
183
|
+
|
|
184
|
+
if (i !== cols.length - 1) {
|
|
185
|
+
colEl.style.borderRight = '1px solid #aaa';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
colEl.className = "_item_table_td _item_table_col_".concat(i, " col-*-*");
|
|
189
|
+
colEl['data-index'] = i;
|
|
190
|
+
colEl.style.minWidth = DEFAULT_COL_WIDTH + 'px';
|
|
191
|
+
colEl.style.height = '100%';
|
|
192
|
+
colEl.style.whiteSpace = 'nowrap';
|
|
193
|
+
colEl.style.overflow = 'hidden';
|
|
194
|
+
colEl.style.textOverflow = 'ellipsis';
|
|
195
|
+
colEl.style.display = 'inline-block';
|
|
196
|
+
colEl.style.float = 'none';
|
|
197
|
+
colEl.innerText = col.columnId;
|
|
198
|
+
this.addColMouseMoveEvent(colEl, colResizeHandler, parentSelectionChecker, i === 0, i === cols.length - 1);
|
|
199
|
+
|
|
200
|
+
const _this = this;
|
|
201
|
+
|
|
202
|
+
colEl.addEventListener('mousedown', function (e) {
|
|
203
|
+
_this.currentClientX = e.clientX;
|
|
204
|
+
_this.curResizeColWidth = _this.getElementWidth(colEl);
|
|
205
|
+
let index = e.target['data-index'];
|
|
206
|
+
let elements = row.parentElement.getElementsByClassName("_item_table_col_".concat(index + 1));
|
|
207
|
+
|
|
208
|
+
if (elements && elements.length > 0) {
|
|
209
|
+
_this.curResizeNxtColWidth = _this.getElementWidth(elements[0]);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
_this.setResizingBorderWidth('2px');
|
|
213
|
+
});
|
|
214
|
+
row.appendChild(colEl);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return row;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
exports.default = TemplateTable;
|