@foxford/pdf-generator 1.1.3 → 1.1.4
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/build/cjs/index.js +171 -144
- package/build/es/index.js +172 -145
- package/build/umd/generator.js +1 -1
- package/build/worker/generator.worker.js +1 -1
- package/package.json +1 -1
package/build/cjs/index.js
CHANGED
|
@@ -27379,6 +27379,46 @@ var InteractiveTraining = /*#__PURE__*/React__default['default'].memo(function I
|
|
|
27379
27379
|
});
|
|
27380
27380
|
});
|
|
27381
27381
|
|
|
27382
|
+
function _arrayWithHoles(arr) {
|
|
27383
|
+
if (Array.isArray(arr)) return arr;
|
|
27384
|
+
}
|
|
27385
|
+
|
|
27386
|
+
function _iterableToArrayLimit(arr, i) {
|
|
27387
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
27388
|
+
if (null != _i) {
|
|
27389
|
+
var _s,
|
|
27390
|
+
_e,
|
|
27391
|
+
_x,
|
|
27392
|
+
_r,
|
|
27393
|
+
_arr = [],
|
|
27394
|
+
_n = !0,
|
|
27395
|
+
_d = !1;
|
|
27396
|
+
try {
|
|
27397
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
27398
|
+
if (Object(_i) !== _i) return;
|
|
27399
|
+
_n = !1;
|
|
27400
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
27401
|
+
} catch (err) {
|
|
27402
|
+
_d = !0, _e = err;
|
|
27403
|
+
} finally {
|
|
27404
|
+
try {
|
|
27405
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
27406
|
+
} finally {
|
|
27407
|
+
if (_d) throw _e;
|
|
27408
|
+
}
|
|
27409
|
+
}
|
|
27410
|
+
return _arr;
|
|
27411
|
+
}
|
|
27412
|
+
}
|
|
27413
|
+
|
|
27414
|
+
function _nonIterableRest() {
|
|
27415
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27416
|
+
}
|
|
27417
|
+
|
|
27418
|
+
function _slicedToArray(arr, i) {
|
|
27419
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
27420
|
+
}
|
|
27421
|
+
|
|
27382
27422
|
var TABLE_WIDTH = 1120;
|
|
27383
27423
|
var TIME_WIDTH = 56;
|
|
27384
27424
|
var HEADER_HEIGHT = 48;
|
|
@@ -27388,6 +27428,27 @@ var CELL_PADDING = 12;
|
|
|
27388
27428
|
var T_PADDING = (TABLE_WIDTH - TIME_WIDTH) / WEEK_DAYS.length;
|
|
27389
27429
|
var Schedule = /*#__PURE__*/React__default['default'].memo(function Schedule(_ref) {
|
|
27390
27430
|
var document = _ref.document;
|
|
27431
|
+
var ref = React.useRef();
|
|
27432
|
+
var _useState = React.useState(1),
|
|
27433
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27434
|
+
scale = _useState2[0],
|
|
27435
|
+
setScale = _useState2[1];
|
|
27436
|
+
var _useState3 = React.useState(LINE_PADDING),
|
|
27437
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
27438
|
+
margin = _useState4[0],
|
|
27439
|
+
setMargin = _useState4[1];
|
|
27440
|
+
React.useEffect(function () {
|
|
27441
|
+
var contentRect = ref.current.getBoundingClientRect();
|
|
27442
|
+
var parentRect = ref.current.parentNode.getBoundingClientRect();
|
|
27443
|
+
var paddings = LINE_PADDING * 2;
|
|
27444
|
+
if (contentRect.height > parentRect.height) {
|
|
27445
|
+
var newScale = parentRect.height * 100 / (contentRect.height + paddings * 2) / 100;
|
|
27446
|
+
setScale(newScale);
|
|
27447
|
+
setMargin((parentRect.width - contentRect.width * newScale) / 2);
|
|
27448
|
+
} else {
|
|
27449
|
+
setScale(contentRect.width * 100 / (parentRect.width + paddings) / 100);
|
|
27450
|
+
}
|
|
27451
|
+
}, []);
|
|
27391
27452
|
var tablePositions = (document.params.items || []).reduce(function (acc, item) {
|
|
27392
27453
|
var counts = item.lessons.reduce(function (counts, _ref2) {
|
|
27393
27454
|
var weekDay = _ref2.weekDay;
|
|
@@ -27404,111 +27465,100 @@ var Schedule = /*#__PURE__*/React__default['default'].memo(function Schedule(_re
|
|
|
27404
27465
|
lineHeight: LINE_HEIGHT * maxInDayLessons
|
|
27405
27466
|
}]);
|
|
27406
27467
|
}, []);
|
|
27407
|
-
return /*#__PURE__*/jsxRuntime.
|
|
27408
|
-
children:
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27413
|
-
|
|
27414
|
-
|
|
27415
|
-
|
|
27416
|
-
|
|
27417
|
-
|
|
27418
|
-
|
|
27419
|
-
|
|
27420
|
-
|
|
27421
|
-
|
|
27422
|
-
|
|
27423
|
-
|
|
27424
|
-
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27428
|
-
|
|
27429
|
-
|
|
27430
|
-
|
|
27431
|
-
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
27440
|
-
|
|
27441
|
-
|
|
27442
|
-
|
|
27443
|
-
|
|
27444
|
-
|
|
27445
|
-
|
|
27446
|
-
|
|
27447
|
-
|
|
27448
|
-
|
|
27449
|
-
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
|
|
27457
|
-
|
|
27458
|
-
|
|
27459
|
-
|
|
27460
|
-
|
|
27461
|
-
|
|
27462
|
-
|
|
27463
|
-
|
|
27464
|
-
|
|
27465
|
-
children: courseName
|
|
27466
|
-
}), /*#__PURE__*/jsxRuntime.jsx("tspan", {
|
|
27467
|
-
fill: "#818183",
|
|
27468
|
+
return /*#__PURE__*/jsxRuntime.jsx(React__default['default'].Fragment, {
|
|
27469
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("g", {
|
|
27470
|
+
ref: ref,
|
|
27471
|
+
transform: "matrix(".concat(scale, " 0 0 ").concat(scale, " ").concat(margin, " ").concat(LINE_PADDING, ")"),
|
|
27472
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27473
|
+
x: "1",
|
|
27474
|
+
y: "1",
|
|
27475
|
+
width: "100%",
|
|
27476
|
+
rx: "5",
|
|
27477
|
+
height: tablePositions[document.params.items.length - 1].lineHeight + tablePositions[document.params.items.length - 1].y,
|
|
27478
|
+
fill: "#F6F7FB"
|
|
27479
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("g", {
|
|
27480
|
+
children: [WEEK_DAYS.map(function (_ref3, index) {
|
|
27481
|
+
var textFull = _ref3.textFull;
|
|
27482
|
+
return /*#__PURE__*/jsxRuntime.jsx("text", {
|
|
27483
|
+
fill: "#818183",
|
|
27484
|
+
fontFamily: "CircleRegular",
|
|
27485
|
+
fontSize: "12",
|
|
27486
|
+
dy: HEADER_HEIGHT / 2,
|
|
27487
|
+
x: T_PADDING * index + TIME_WIDTH + CELL_PADDING,
|
|
27488
|
+
children: textFull
|
|
27489
|
+
}, index);
|
|
27490
|
+
}), (document.params.items || []).map(function (_ref4, i) {
|
|
27491
|
+
var time = _ref4.time;
|
|
27492
|
+
return /*#__PURE__*/jsxRuntime.jsx("text", {
|
|
27493
|
+
fill: "#818183",
|
|
27494
|
+
fontFamily: "CircleRegular",
|
|
27495
|
+
fontSize: "14",
|
|
27496
|
+
dx: CELL_PADDING,
|
|
27497
|
+
dy: tablePositions[i].y + CELL_PADDING * 2,
|
|
27498
|
+
children: time
|
|
27499
|
+
}, "time_".concat(i));
|
|
27500
|
+
}), (document.params.items || []).map(function (_ref5, i) {
|
|
27501
|
+
var lessons = _ref5.lessons;
|
|
27502
|
+
return WEEK_DAYS.map(function (_, weekDayIndex) {
|
|
27503
|
+
var weekLessons = lessons.filter(function (_ref6) {
|
|
27504
|
+
var weekDay = _ref6.weekDay;
|
|
27505
|
+
return weekDay === weekDayIndex + 1;
|
|
27506
|
+
});
|
|
27507
|
+
if (weekLessons.length === 0) {
|
|
27508
|
+
return null;
|
|
27509
|
+
}
|
|
27510
|
+
return weekLessons.map(function (_ref7, lessonIndex) {
|
|
27511
|
+
var courseName = _ref7.courseName,
|
|
27512
|
+
teacherName = _ref7.teacherName;
|
|
27513
|
+
return /*#__PURE__*/jsxRuntime.jsxs(React__default['default'].Fragment, {
|
|
27514
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("clipPath", {
|
|
27515
|
+
id: "item_".concat(i, "_").concat(weekDayIndex, "_").concat(lessonIndex),
|
|
27516
|
+
children: /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27517
|
+
x: weekDayIndex * T_PADDING + TIME_WIDTH + CELL_PADDING,
|
|
27518
|
+
y: tablePositions[i].y,
|
|
27519
|
+
width: "190",
|
|
27520
|
+
height: tablePositions[i].lineHeight
|
|
27521
|
+
})
|
|
27522
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("text", {
|
|
27523
|
+
fontFamily: "CircleRegular",
|
|
27524
|
+
fontSize: "15",
|
|
27525
|
+
clipPath: "url(#".concat("item_".concat(i, "_").concat(weekDayIndex, "_").concat(lessonIndex), ")"),
|
|
27468
27526
|
x: weekDayIndex * T_PADDING + TIME_WIDTH + CELL_PADDING,
|
|
27469
|
-
|
|
27470
|
-
|
|
27527
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("tspan", {
|
|
27528
|
+
dy: tablePositions[i].y + CELL_PADDING * 2 + lessonIndex * LINE_HEIGHT,
|
|
27529
|
+
fill: "#333333",
|
|
27530
|
+
children: courseName
|
|
27531
|
+
}), /*#__PURE__*/jsxRuntime.jsx("tspan", {
|
|
27532
|
+
fill: "#818183",
|
|
27533
|
+
x: weekDayIndex * T_PADDING + TIME_WIDTH + CELL_PADDING,
|
|
27534
|
+
dy: LINE_PADDING,
|
|
27535
|
+
children: teacherName
|
|
27536
|
+
})]
|
|
27471
27537
|
})]
|
|
27472
|
-
})
|
|
27473
|
-
}
|
|
27538
|
+
}, "item_".concat(i, "_").concat(weekDayIndex, "_").concat(lessonIndex));
|
|
27539
|
+
});
|
|
27474
27540
|
});
|
|
27475
|
-
})
|
|
27476
|
-
})
|
|
27477
|
-
|
|
27478
|
-
|
|
27479
|
-
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
|
|
27483
|
-
|
|
27484
|
-
|
|
27485
|
-
|
|
27486
|
-
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
})
|
|
27490
|
-
},
|
|
27491
|
-
}), /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27492
|
-
x: "0",
|
|
27493
|
-
y: "0",
|
|
27494
|
-
width: "100%",
|
|
27495
|
-
height: HEADER_HEIGHT,
|
|
27496
|
-
style: {
|
|
27497
|
-
fill: 'none',
|
|
27498
|
-
stroke: '#D4D4D4',
|
|
27499
|
-
strokeWidth: 1,
|
|
27500
|
-
strokeLinecap: 'butt',
|
|
27501
|
-
strokeLinejoin: 'miter',
|
|
27502
|
-
strokeMiterlimit: 10,
|
|
27503
|
-
strokeDasharray: 'none',
|
|
27504
|
-
strokeOpacity: 1
|
|
27505
|
-
}
|
|
27506
|
-
}), (document.params.items || []).map(function (item, index) {
|
|
27507
|
-
return /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27541
|
+
})]
|
|
27542
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("g", {
|
|
27543
|
+
children: [WEEK_DAYS.map(function (_ref8, weekDayIndex) {
|
|
27544
|
+
_ref8.textFull;
|
|
27545
|
+
return /*#__PURE__*/jsxRuntime.jsx(React__default['default'].Fragment, {
|
|
27546
|
+
children: /*#__PURE__*/jsxRuntime.jsx("line", {
|
|
27547
|
+
x1: T_PADDING * weekDayIndex + TIME_WIDTH,
|
|
27548
|
+
y1: "0",
|
|
27549
|
+
x2: T_PADDING * weekDayIndex + TIME_WIDTH,
|
|
27550
|
+
y2: tablePositions.reduce(function (acc, position) {
|
|
27551
|
+
return acc + position.lineHeight;
|
|
27552
|
+
}, HEADER_HEIGHT),
|
|
27553
|
+
stroke: "#D4D4D4"
|
|
27554
|
+
})
|
|
27555
|
+
}, weekDayIndex);
|
|
27556
|
+
}), /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27508
27557
|
x: "0",
|
|
27509
|
-
y:
|
|
27558
|
+
y: "0",
|
|
27510
27559
|
width: "100%",
|
|
27511
|
-
|
|
27560
|
+
rx: "5",
|
|
27561
|
+
height: tablePositions[document.params.items.length - 1].lineHeight + tablePositions[document.params.items.length - 1].y,
|
|
27512
27562
|
style: {
|
|
27513
27563
|
fill: 'none',
|
|
27514
27564
|
stroke: '#D4D4D4',
|
|
@@ -27519,9 +27569,26 @@ var Schedule = /*#__PURE__*/React__default['default'].memo(function Schedule(_re
|
|
|
27519
27569
|
strokeDasharray: 'none',
|
|
27520
27570
|
strokeOpacity: 1
|
|
27521
27571
|
}
|
|
27522
|
-
},
|
|
27572
|
+
}), (document.params.items || []).map(function (item, index) {
|
|
27573
|
+
return /*#__PURE__*/jsxRuntime.jsx("rect", {
|
|
27574
|
+
x: "0",
|
|
27575
|
+
y: tablePositions[index].y,
|
|
27576
|
+
width: "100%",
|
|
27577
|
+
height: tablePositions[index].lineHeight,
|
|
27578
|
+
style: {
|
|
27579
|
+
fill: 'none',
|
|
27580
|
+
stroke: '#D4D4D4',
|
|
27581
|
+
strokeWidth: 1,
|
|
27582
|
+
strokeLinecap: 'butt',
|
|
27583
|
+
strokeLinejoin: 'miter',
|
|
27584
|
+
strokeMiterlimit: 10,
|
|
27585
|
+
strokeDasharray: '116%, 125%',
|
|
27586
|
+
strokeOpacity: 1
|
|
27587
|
+
}
|
|
27588
|
+
}, "item_rect_".concat(index));
|
|
27589
|
+
})]
|
|
27523
27590
|
})]
|
|
27524
|
-
})
|
|
27591
|
+
})
|
|
27525
27592
|
});
|
|
27526
27593
|
});
|
|
27527
27594
|
|
|
@@ -27959,46 +28026,6 @@ function withStyle(WrapperComponent) {
|
|
|
27959
28026
|
}(React__default['default'].PureComponent), _class.displayName = 'DocumentWithStyle', _class;
|
|
27960
28027
|
}
|
|
27961
28028
|
|
|
27962
|
-
function _arrayWithHoles(arr) {
|
|
27963
|
-
if (Array.isArray(arr)) return arr;
|
|
27964
|
-
}
|
|
27965
|
-
|
|
27966
|
-
function _iterableToArrayLimit(arr, i) {
|
|
27967
|
-
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
27968
|
-
if (null != _i) {
|
|
27969
|
-
var _s,
|
|
27970
|
-
_e,
|
|
27971
|
-
_x,
|
|
27972
|
-
_r,
|
|
27973
|
-
_arr = [],
|
|
27974
|
-
_n = !0,
|
|
27975
|
-
_d = !1;
|
|
27976
|
-
try {
|
|
27977
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
27978
|
-
if (Object(_i) !== _i) return;
|
|
27979
|
-
_n = !1;
|
|
27980
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
27981
|
-
} catch (err) {
|
|
27982
|
-
_d = !0, _e = err;
|
|
27983
|
-
} finally {
|
|
27984
|
-
try {
|
|
27985
|
-
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
27986
|
-
} finally {
|
|
27987
|
-
if (_d) throw _e;
|
|
27988
|
-
}
|
|
27989
|
-
}
|
|
27990
|
-
return _arr;
|
|
27991
|
-
}
|
|
27992
|
-
}
|
|
27993
|
-
|
|
27994
|
-
function _nonIterableRest() {
|
|
27995
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
27996
|
-
}
|
|
27997
|
-
|
|
27998
|
-
function _slicedToArray(arr, i) {
|
|
27999
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
28000
|
-
}
|
|
28001
|
-
|
|
28002
28029
|
function withLayout(WrapperComponent) {
|
|
28003
28030
|
var _class;
|
|
28004
28031
|
return _class = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -28443,7 +28470,7 @@ var initialState = function () {
|
|
|
28443
28470
|
resources: []
|
|
28444
28471
|
};
|
|
28445
28472
|
}();
|
|
28446
|
-
var workerUrl = "https://dist.ngcdn.ru" + "/libs/pdf-generator/" + "1.1.
|
|
28473
|
+
var workerUrl = "https://dist.ngcdn.ru" + "/libs/pdf-generator/" + "1.1.4" + '/' + "generator.worker.js";
|
|
28447
28474
|
var Generator = /*#__PURE__*/function (_React$Component) {
|
|
28448
28475
|
_inherits$1(Generator, _React$Component);
|
|
28449
28476
|
var _super = _createSuper(Generator);
|
|
@@ -29111,7 +29138,7 @@ var WebDocument = /*#__PURE__*/_createClass$1(function WebDocument(params) {
|
|
|
29111
29138
|
this._onError = params.onError || null;
|
|
29112
29139
|
this.info = {};
|
|
29113
29140
|
this._fonts = [];
|
|
29114
|
-
this.workerUrl = "https://dist.ngcdn.ru" + "/libs/pdf-generator/" + "1.1.
|
|
29141
|
+
this.workerUrl = "https://dist.ngcdn.ru" + "/libs/pdf-generator/" + "1.1.4" + '/' + "generator.worker.js";
|
|
29115
29142
|
});
|
|
29116
29143
|
var createDocument = function createDocument(data) {
|
|
29117
29144
|
return new WebDocument(data);
|