@dvrd/dvr-controls 1.0.6 → 1.0.7

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.
Files changed (177) hide show
  1. package/package.json +1 -1
  2. package/src/js/button/button.tsx +0 -102
  3. package/src/js/button/buttonController.tsx +0 -179
  4. package/src/js/button/closeButton.tsx +0 -29
  5. package/src/js/button/dvrdButton.tsx +0 -128
  6. package/src/js/button/outlinedButton.tsx +0 -105
  7. package/src/js/button/simpleButton.tsx +0 -163
  8. package/src/js/button/style/button.scss +0 -95
  9. package/src/js/button/style/closeButton.scss +0 -15
  10. package/src/js/button/style/dvrdButton.scss +0 -30
  11. package/src/js/button/style/outlinedButton.scss +0 -84
  12. package/src/js/button/style/simpleButton.scss +0 -80
  13. package/src/js/carousel/DVRCarousel.tsx +0 -163
  14. package/src/js/carousel/DVRCarouselController.tsx +0 -95
  15. package/src/js/carousel/style/DVRCarousel.scss +0 -38
  16. package/src/js/checkbox/checkbox.tsx +0 -147
  17. package/src/js/checkbox/checkboxController.tsx +0 -131
  18. package/src/js/checkbox/style/checkbox.scss +0 -109
  19. package/src/js/colorPicker/colorPicker.tsx +0 -118
  20. package/src/js/colorPicker/style/colorPicker.scss +0 -20
  21. package/src/js/date/dvrdDatePicker.tsx +0 -357
  22. package/src/js/date/style/dvrdDatePicker.scss +0 -307
  23. package/src/js/dialog/dialog.tsx +0 -207
  24. package/src/js/dialog/dialogController.tsx +0 -70
  25. package/src/js/dialog/inlineDialog.tsx +0 -127
  26. package/src/js/dialog/style/dialog.scss +0 -61
  27. package/src/js/events/withEvents.tsx +0 -40
  28. package/src/js/head/DVRHead.tsx +0 -49
  29. package/src/js/header/DVRHeader.tsx +0 -413
  30. package/src/js/header/style/header.scss +0 -206
  31. package/src/js/icon/awesomeIcon.tsx +0 -46
  32. package/src/js/image/imageUpload.tsx +0 -69
  33. package/src/js/image/style/imageUpload.scss +0 -11
  34. package/src/js/info/info.tsx +0 -136
  35. package/src/js/info/style/info.scss +0 -39
  36. package/src/js/input/animated/animatedTextField.tsx +0 -159
  37. package/src/js/input/date/dateField.tsx +0 -360
  38. package/src/js/input/date/dateFieldController.tsx +0 -245
  39. package/src/js/input/date/datePicker/datePicker.tsx +0 -186
  40. package/src/js/input/date/datePicker/style/datePicker.scss +0 -102
  41. package/src/js/input/date/input/dateInput.tsx +0 -213
  42. package/src/js/input/date/style/dateField.scss +0 -40
  43. package/src/js/input/date/timePicker/style/timePicker.scss +0 -95
  44. package/src/js/input/date/timePicker/timePicker.tsx +0 -143
  45. package/src/js/input/editor/DVREditor.tsx +0 -21
  46. package/src/js/input/number/numberInput.tsx +0 -157
  47. package/src/js/input/password/passwordInput.tsx +0 -140
  48. package/src/js/input/password/passwordRules.tsx +0 -48
  49. package/src/js/input/password/style/passwordInput.scss +0 -39
  50. package/src/js/input/password/style/passwordRules.scss +0 -41
  51. package/src/js/input/simple/style/simpleInput.scss +0 -98
  52. package/src/js/input/simple/v2/simpleInputV2.tsx +0 -178
  53. package/src/js/input/style/input.scss +0 -138
  54. package/src/js/input/v2/inputController_v2.tsx +0 -250
  55. package/src/js/input/v2/input_v2.tsx +0 -7
  56. package/src/js/label/label.tsx +0 -196
  57. package/src/js/label/style/label.scss +0 -4
  58. package/src/js/link/link.tsx +0 -38
  59. package/src/js/link/style/link.scss +0 -30
  60. package/src/js/loader/loader.tsx +0 -79
  61. package/src/js/loader/loaderController.tsx +0 -61
  62. package/src/js/loader/style/loader.scss +0 -53
  63. package/src/js/media/media.tsx +0 -72
  64. package/src/js/navigator/navigator.tsx +0 -51
  65. package/src/js/optionsList/dvrdOptionsList.tsx +0 -112
  66. package/src/js/optionsList/style/dvrdOptionsList.scss +0 -84
  67. package/src/js/optionsMenu/optionsMenu.tsx +0 -187
  68. package/src/js/optionsMenu/style/optionsMenu.scss +0 -70
  69. package/src/js/pdf/element/pdfElement.tsx +0 -315
  70. package/src/js/pdf/element/style/pdfElement.scss +0 -111
  71. package/src/js/pdf/history/pdfHistory.ts +0 -57
  72. package/src/js/pdf/image/pdfImage.tsx +0 -175
  73. package/src/js/pdf/image/style/pdfImage.scss +0 -34
  74. package/src/js/pdf/invoiceTable/pdfInvoiceTable.tsx +0 -176
  75. package/src/js/pdf/invoiceTable/style/pdfInvoiceTable.scss +0 -32
  76. package/src/js/pdf/pdfTemplateCreator.tsx +0 -278
  77. package/src/js/pdf/settings/buttons/iconButton.tsx +0 -49
  78. package/src/js/pdf/settings/buttons/style/iconButton.scss +0 -50
  79. package/src/js/pdf/settings/image/pdfImageSettings.tsx +0 -82
  80. package/src/js/pdf/settings/image/style/pdfImageSettings.scss +0 -9
  81. package/src/js/pdf/settings/invoiceTable/pdfInvoiceTableSettings.tsx +0 -141
  82. package/src/js/pdf/settings/invoiceTable/style/pdfInvoiceTableSettings.scss +0 -38
  83. package/src/js/pdf/settings/pdfElementSettings.tsx +0 -86
  84. package/src/js/pdf/settings/style/pdfElementSettings.scss +0 -56
  85. package/src/js/pdf/settings/text/pdfTextSettings.tsx +0 -202
  86. package/src/js/pdf/settings/text/style/pdfTextSettings.scss +0 -94
  87. package/src/js/pdf/style/pdfTemplateCreator.scss +0 -118
  88. package/src/js/pdf/text/pdfText.tsx +0 -267
  89. package/src/js/pdf/text/style/pdfText.scss +0 -22
  90. package/src/js/popup/style/withBackground.scss +0 -29
  91. package/src/js/popup/withBackground.tsx +0 -102
  92. package/src/js/select/async/asyncSelect.tsx +0 -46
  93. package/src/js/select/async/style/asyncSelect.scss +0 -23
  94. package/src/js/select/dvrdSelect.tsx +0 -185
  95. package/src/js/select/dvrdSelectController.tsx +0 -81
  96. package/src/js/select/select.tsx +0 -310
  97. package/src/js/select/selectController.tsx +0 -341
  98. package/src/js/select/style/dvrdSelect.scss +0 -140
  99. package/src/js/select/style/select.scss +0 -199
  100. package/src/js/sidebarMenu/sidebarMenu.tsx +0 -165
  101. package/src/js/sidebarMenu/style/sidebarMenu.scss +0 -161
  102. package/src/js/slider/DVRSlider.tsx +0 -107
  103. package/src/js/slider/style/DVRSlider.scss +0 -88
  104. package/src/js/snackbar/snackbar.tsx +0 -72
  105. package/src/js/snackbar/snackbarController.tsx +0 -104
  106. package/src/js/snackbar/style/snackbar.scss +0 -46
  107. package/src/js/switch/dvrdSwitch.tsx +0 -53
  108. package/src/js/switch/style/dvrdSwitch.scss +0 -47
  109. package/src/js/switch/style/switch.scss +0 -84
  110. package/src/js/switch/switch.tsx +0 -115
  111. package/src/js/switch/switchController.tsx +0 -97
  112. package/src/js/textField/dvrdInput.tsx +0 -217
  113. package/src/js/textField/dvrdInputController.tsx +0 -97
  114. package/src/js/textField/dvrdNumberInput.tsx +0 -141
  115. package/src/js/textField/dvrdPasswordInput.tsx +0 -40
  116. package/src/js/textField/style/dvrdInput.scss +0 -114
  117. package/src/js/textField/style/dvrdPassword.scss +0 -15
  118. package/src/js/topButton/style/topButton.scss +0 -54
  119. package/src/js/topButton/topButton.tsx +0 -135
  120. package/src/js/util/analyticsUtil.ts +0 -41
  121. package/src/js/util/colorUtil.ts +0 -230
  122. package/src/js/util/componentUtil.tsx +0 -59
  123. package/src/js/util/constants.ts +0 -12
  124. package/src/js/util/controlContext.tsx +0 -46
  125. package/src/js/util/controlUtil.ts +0 -107
  126. package/src/js/util/cookieUtil.ts +0 -17
  127. package/src/js/util/eventUtil.ts +0 -65
  128. package/src/js/util/googleUtil.ts +0 -88
  129. package/src/js/util/interfaces.ts +0 -179
  130. package/src/js/util/jwtUtil.ts +0 -72
  131. package/src/js/util/miscUtil.ts +0 -170
  132. package/src/js/util/momentUtil.ts +0 -45
  133. package/src/js/util/pdfUtil.ts +0 -124
  134. package/src/js/util/requestUtil.ts +0 -145
  135. package/src/js/util/responsiveUtil.ts +0 -37
  136. package/src/js/util/validationUtil.ts +0 -13
  137. package/src/res/img/lock-handle.png +0 -0
  138. package/src/res/img/lock-handle.webp +0 -0
  139. package/src/res/img/lock.png +0 -0
  140. package/src/res/img/lock.webp +0 -0
  141. package/src/style/common-icons-variables.scss +0 -140
  142. package/src/style/common-icons.scss +0 -714
  143. package/src/style/common-variables.scss +0 -243
  144. package/src/style/display-breakpoints.scss +0 -141
  145. package/src/style/fonts/common-icons.eot +0 -0
  146. package/src/style/fonts/common-icons.svg +0 -150
  147. package/src/style/fonts/common-icons.ttf +0 -0
  148. package/src/style/fonts/common-icons.woff +0 -0
  149. package/src/style/fonts/common-icons.woff2 +0 -0
  150. package/src/style/fonts/fontAwesome/css/all.css +0 -7003
  151. package/src/style/fonts/fontAwesome/css/all.min.css +0 -6
  152. package/src/style/fonts/fontAwesome/css/brands.css +0 -1423
  153. package/src/style/fonts/fontAwesome/css/brands.min.css +0 -6
  154. package/src/style/fonts/fontAwesome/css/fontawesome.css +0 -5519
  155. package/src/style/fonts/fontAwesome/css/fontawesome.min.css +0 -6
  156. package/src/style/fonts/fontAwesome/css/regular.css +0 -19
  157. package/src/style/fonts/fontAwesome/css/regular.min.css +0 -6
  158. package/src/style/fonts/fontAwesome/css/solid.css +0 -19
  159. package/src/style/fonts/fontAwesome/css/solid.min.css +0 -6
  160. package/src/style/fonts/fontAwesome/css/svg-with-js.css +0 -634
  161. package/src/style/fonts/fontAwesome/css/svg-with-js.min.css +0 -6
  162. package/src/style/fonts/fontAwesome/css/v4-font-face.css +0 -26
  163. package/src/style/fonts/fontAwesome/css/v4-font-face.min.css +0 -6
  164. package/src/style/fonts/fontAwesome/css/v4-shims.css +0 -2146
  165. package/src/style/fonts/fontAwesome/css/v4-shims.min.css +0 -6
  166. package/src/style/fonts/fontAwesome/css/v5-font-face.css +0 -22
  167. package/src/style/fonts/fontAwesome/css/v5-font-face.min.css +0 -6
  168. package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.ttf +0 -0
  169. package/src/style/fonts/fontAwesome/webfonts/fa-brands-400.woff2 +0 -0
  170. package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.ttf +0 -0
  171. package/src/style/fonts/fontAwesome/webfonts/fa-regular-400.woff2 +0 -0
  172. package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.ttf +0 -0
  173. package/src/style/fonts/fontAwesome/webfonts/fa-solid-900.woff2 +0 -0
  174. package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.ttf +0 -0
  175. package/src/style/fonts/fontAwesome/webfonts/fa-v4compatibility.woff2 +0 -0
  176. package/src/style/variables.scss +0 -11
  177. package/tsconfig.json +0 -15
@@ -1,118 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../style/variables';
6
-
7
- .pdf-creator {
8
- margin: 2rem auto;
9
- display: grid;
10
- grid-template-columns: repeat(2, auto) minmax(min-content, 30rem);
11
- align-items: start;
12
- grid-row-gap: 1rem;
13
- position: relative;
14
- justify-content: center;
15
-
16
- .right-col {
17
- position: sticky;
18
- top: 4rem;
19
- }
20
-
21
- .elements-container {
22
- display: grid;
23
- grid-template-columns: auto;
24
- background-color: white;
25
- grid-row-gap: 1rem;
26
- padding: 1rem;
27
- position: sticky;
28
- top: 4rem;
29
- border: 1px solid $color-gray-7;
30
- border-radius: .5rem;
31
-
32
- .element-button {
33
- @include backgroundShadow;
34
- border-radius: .5rem;
35
- cursor: pointer;
36
- transition: background-color .2s ease-in-out;
37
- display: grid;
38
- grid-template-columns: 2rem 1fr;
39
- grid-column-gap: 1rem;
40
- align-items: center;
41
- color: $color-gray-5;
42
- padding: .5rem;
43
-
44
- .element-label {
45
- white-space: nowrap;
46
- }
47
-
48
- .element-icon {
49
- font-size: 2rem;
50
- }
51
-
52
- &:hover {
53
- background-color: $color-gray-6;
54
- }
55
- }
56
-
57
- .history {
58
- display: grid;
59
- grid-template-columns: 1fr 1fr;
60
- grid-column-gap: 1rem;
61
-
62
- .history-button {
63
- @include backgroundShadow;
64
- border-radius: .5rem;
65
- cursor: pointer;
66
- transition: background-color .2s ease-in-out;
67
- padding: .5rem 1rem;
68
- text-align: center;
69
-
70
- &:hover {
71
- background-color: $color-gray-7;
72
- }
73
-
74
- &.disabled {
75
- cursor: not-allowed;
76
- background-color: white !important;
77
- box-shadow: none;
78
- border: 1px solid $color-gray-4;
79
-
80
- .history-icon {
81
- color: $color-gray-4;
82
- }
83
- }
84
- }
85
- }
86
-
87
- .history-reset {
88
- display: flex;
89
- justify-content: center;
90
- }
91
- }
92
-
93
- .pdf-paper {
94
- @include backgroundShadow;
95
- border-radius: .5rem;
96
- width: 595pt;
97
- height: 842pt;
98
- background-color: white;
99
- position: relative;
100
- overflow: hidden;
101
- z-index: 1;
102
- }
103
-
104
- .footer-container {
105
- @include backgroundShadow;
106
- border-radius: .5rem;
107
- grid-column: 2;
108
- padding: 1rem;
109
- background-color: white;
110
- display: flex;
111
- justify-content: space-between;
112
- align-items: center;
113
-
114
- .proceed-btn {
115
- margin-left: 1rem;
116
- }
117
- }
118
- }
@@ -1,267 +0,0 @@
1
- /*
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
- import './style/pdfText.scss';
5
-
6
- import React, {CSSProperties, MouseEventHandler} from 'react';
7
- import {
8
- CustomAppEvent,
9
- IndexedObject,
10
- PDFDisplay,
11
- PDFElementParams,
12
- PDFElementPersist,
13
- PDFElementType,
14
- PdfFont,
15
- PDFTextParams,
16
- PDFTextVariables
17
- } from "../../util/interfaces";
18
- import {PDFDraggable, PdfElement} from "../element/pdfElement";
19
- import {debug, sanitizeHtml} from "../../util/miscUtil";
20
- import {merge} from 'lodash';
21
- import {PAGE_WIDTH, pxToPt, setPdfVariables, waitForFonts} from "../../util/pdfUtil";
22
- import {directTimeout} from "../../util/componentUtil";
23
- import {dispatchCustomEvent, showDialog} from "../../util/eventUtil";
24
- import {remToPx, WithEvents} from "../../../../";
25
-
26
- interface Props {
27
- onDelete: MouseEventHandler;
28
- onSaveHistory: VoidFunction;
29
- values: IndexedObject<string>;
30
- defaultSettings?: Partial<PDFTextParams>;
31
- id?: string;
32
- customVariables?: PDFTextVariables;
33
- defaultPosition: { x: number; y: number };
34
- draggable: boolean;
35
- onFocusElement: (element: PdfElement) => void;
36
- persistent?: PDFElementPersist;
37
- mainFont: PdfFont;
38
- linkedID?: string;
39
- }
40
-
41
- interface State {
42
- settings: PDFTextParams;
43
- dragging: boolean;
44
- focused: boolean;
45
- }
46
-
47
- export default class PdfText extends PdfElement<Props, State> {
48
- static defaultProps = {
49
- defaultPosition: {x: 0, y: 0},
50
- };
51
- private lastKnownCursor: number = 0;
52
- private field: HTMLTextAreaElement;
53
- private initialWidth: number | null = null;
54
- private currentText: string = '';
55
- private readonly events: CustomAppEvent[];
56
-
57
- constructor(props: Props) {
58
- super(props);
59
- this.state = {
60
- settings: merge({}, {
61
- text: 'Klik hier om deze tekst aan te passen.',
62
- bold: false,
63
- underline: false,
64
- italic: false,
65
- fontSize: remToPx(1),
66
- alignment: undefined,
67
- font: props.mainFont,
68
- color: '#000',
69
- persistent: PDFElementPersist.NOT_PERSISTENT,
70
- display: PDFDisplay.ALL_PAGES,
71
- }, props.defaultSettings),
72
- dragging: false,
73
- focused: false,
74
- }
75
- this.currentText = this.state.settings.text;
76
- this.events = [this.event, {eventName: 'onLinkedElementMoved', handler: this.onLinkedElementMoved}]
77
- }
78
-
79
- private onBlur = (evt: React.FocusEvent<HTMLTextAreaElement>) => {
80
- this.lastKnownCursor = evt.target.selectionEnd || 0;
81
- this.setState({focused: false}, this.setWidth);
82
- if (this.state.settings.text !== this.currentText) this.props.onSaveHistory();
83
- };
84
-
85
- private onFocus = (evt: React.FocusEvent) => {
86
- evt.stopPropagation();
87
- this.setState({focused: true}, this.setWidth);
88
- this.currentText = this.state.settings.text;
89
- this.onClick();
90
- };
91
-
92
- getTextValue = (): string => {
93
- const {settings, focused} = this.state, {values} = this.props;
94
- if (focused) return settings.text;
95
- return setPdfVariables(settings.text, values);
96
- }
97
-
98
- public setSetting = (key: string, value: any, callback?: VoidFunction, save: boolean = true) => {
99
- this.setState({settings: Object.assign({}, this.state.settings, {[key]: value})}, () => {
100
- this.setWidth();
101
- if (key !== 'text' && save)
102
- this.props.onSaveHistory();
103
- if (callback) callback();
104
- });
105
- };
106
-
107
- public onClickDelete = (evt: React.MouseEvent) => {
108
- const {persistent, onDelete} = this.props;
109
- if (persistent === 'confirm')
110
- showDialog('We raden aan om dit element wel te tonen op de factuur. Weet je zeker dat je dit ' +
111
- 'element wilt verwijderen?', 'Element verwijderen',
112
- ['Nee', {label: 'Ja', onClick: onDelete}]);
113
- else onDelete(evt);
114
- };
115
-
116
- onClickEdit = (evt: React.MouseEvent) => {
117
- if (this.field) {
118
- this.field.focus();
119
- const {value} = this.field;
120
- this.field.selectionStart = value.length;
121
- this.field.selectionEnd = this.field.selectionStart;
122
- }
123
- this.onClick(evt);
124
- };
125
-
126
- onClick = (evt?: React.MouseEvent) => {
127
- if (evt)
128
- evt.stopPropagation();
129
- this.props.onFocusElement(this);
130
- if (this.draggable)
131
- this.draggable.setFocus();
132
- };
133
-
134
- onChange = (evt: React.ChangeEvent<HTMLTextAreaElement>) => {
135
- const {target} = evt;
136
- this.setSetting('text', target.value, this.setWidth);
137
- }
138
-
139
- onClickBar = (evt: React.MouseEvent) => {
140
- this.onClick(evt);
141
- };
142
-
143
- onDrag = (position: { x: number; y: number }) => {
144
- const {linkedID} = this.props;
145
- if (linkedID)
146
- dispatchCustomEvent('onLinkedElementMoved', {position, id: linkedID, elementId: this.id});
147
- }
148
-
149
- onLinkedElementMoved = (data: { position: { x: number; y: number }, id: string; elementId: string }) => {
150
- const {linkedID} = this.props;
151
- if (this.draggable && linkedID && data.id === linkedID && data.elementId !== this.id)
152
- this.draggable.setPosition({x: data.position.x});
153
- };
154
-
155
- /**
156
- * Externally insert text add last know cursor position
157
- * @param newText
158
- */
159
- public insertText = (newText: string) => {
160
- const {settings} = this.state;
161
- let {text} = settings;
162
- text = text.substr(0, this.lastKnownCursor) + newText + text.substr(this.lastKnownCursor, text.length);
163
- this.setState({settings: Object.assign({}, settings, {text})}, () => {
164
- this.setWidth();
165
- if (this.field) {
166
- this.field.selectionStart = this.field.selectionStart + newText.length;
167
- this.field.selectionEnd = this.field.selectionStart;
168
- this.field.focus();
169
- }
170
- this.props.onSaveHistory();
171
- });
172
- };
173
-
174
- private setWidth = () => {
175
- const position = this.draggable?.getPosition() || {x: 0},
176
- maxWidth = PAGE_WIDTH - position.x, {linkedID} = this.props
177
- if (this.field) {
178
- this.field.style.width = '0px';
179
- this.field.style.width = this.field.scrollWidth + 'px';
180
- this.initialWidth = this.initialWidth ?? this.field.scrollWidth;
181
- if (this.field.scrollWidth > maxWidth && this.draggable) {
182
- this.draggable.setPosition({x: PAGE_WIDTH - this.field.scrollWidth}, () => {
183
- dispatchCustomEvent('onLinkedElementMoved',
184
- {position: this.draggable.getPosition(), id: linkedID, elementId: this.id});
185
- });
186
- }
187
- }
188
- };
189
-
190
- getParams = (convertPixels: boolean = true): PDFElementParams<PDFElementType.TEXT, PDFTextParams> => {
191
- const {settings} = this.state,
192
- {bold, italic, text, underline, alignment, font, color, persistent, display} = settings,
193
- fontSize = convertPixels ? pxToPt(settings.fontSize) : settings.fontSize, {linkedID} = this.props;
194
- return {
195
- dimensions: this.getDimensions(convertPixels),
196
- key: this.id,
197
- type: PDFElementType.TEXT,
198
- options: {fontSize: fontSize, bold, italic, text, underline, alignment, font, color, persistent, display},
199
- linkedID: linkedID,
200
- };
201
- }
202
-
203
- private getTextStyle = (): CSSProperties => {
204
- const {italic, underline, bold, fontSize, font, color} = this.state.settings,
205
- styles: CSSProperties = {fontSize, fontFamily: font, color};
206
- if (italic) styles.fontStyle = 'italic';
207
- if (underline) styles.textDecoration = 'underline';
208
- if (bold) styles.fontWeight = font === PdfFont.HELVETICA ? 600 : 500;
209
- return styles;
210
- };
211
-
212
- private getRows = () => {
213
- const {text} = this.state.settings;
214
- return text.split('\n').length;
215
- };
216
-
217
- componentDidMount = () => {
218
- directTimeout(this.setWidth);
219
- if (this.props.linkedID) {
220
- directTimeout(() => {
221
- if (this.draggable) {
222
- debug('Dispatch event');
223
- dispatchCustomEvent('onLinkedElementMoved',
224
- {position: this.draggable.getPosition(), id: this.props.linkedID, elementId: this.id});
225
- }
226
- })
227
- }
228
- waitForFonts(this.setWidth);
229
- };
230
-
231
- componentDidUpdate = (prevProps: Props, prevState: State) => {
232
- const {settings} = this.state, prevSettings = prevState.settings;
233
- if (settings.font !== prevSettings.font) waitForFonts(this.setWidth);
234
- }
235
-
236
- render = () => {
237
- const {settings, dragging} = this.state, {
238
- draggable,
239
- defaultPosition,
240
- onSaveHistory,
241
- persistent
242
- } = this.props;
243
- return (
244
- <WithEvents events={this.events}>
245
- <PDFDraggable onDrag={this.onDrag} onDragEnd={this.onDragEnd} position={defaultPosition}
246
- elementLabel='Tekst' alignment={settings.alignment} onDragStart={this.onDragStart}
247
- draggable={draggable} dragging={dragging} resizeable={false} onDragged={onSaveHistory}
248
- onResized={onSaveHistory} persistent={persistent} onDelete={this.onClickDelete}
249
- onEdit={this.onClickEdit} ref={(ref: PDFDraggable) => {
250
- this.draggable = ref
251
- }} forwardRef={(ref: HTMLDivElement) => {
252
- this.element = ref
253
- }} onClickBar={this.onClickBar}>
254
- <div className='pdf-text-container'>
255
- <textarea className='pdf-text-input' style={this.getTextStyle()}
256
- readOnly={settings.disabled === true}
257
- value={sanitizeHtml(this.getTextValue())} onChange={this.onChange}
258
- rows={this.getRows()} onFocus={this.onFocus} onBlur={this.onBlur} onClick={this.onClick}
259
- ref={(ref: HTMLTextAreaElement) => {
260
- this.field = ref
261
- }}/>
262
- </div>
263
- </PDFDraggable>
264
- </WithEvents>
265
- )
266
- }
267
- }
@@ -1,22 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../../style/variables';
6
-
7
- .pdf-text-container {
8
- .pdf-text-input {
9
- border: none !important;
10
- outline: none !important;
11
- resize: none;
12
- background-color: transparent;
13
- padding: 0;
14
- overflow: hidden;
15
- line-height: 1.5;
16
- white-space: pre;
17
-
18
- &:disabled {
19
- color: black;
20
- }
21
- }
22
- }
@@ -1,29 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../style/variables';
6
-
7
- .with-background {
8
- @include popupContainer;
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- z-index: $z-index-dialog;
13
-
14
- .content-container {
15
- width: fit-content;
16
- height: fit-content;
17
-
18
- .header-container {
19
- display: flex;
20
- justify-content: space-between;
21
- align-items: center;
22
-
23
- .header-title {
24
- font-size: 1.2rem;
25
- font-weight: 500;
26
- }
27
- }
28
- }
29
- }
@@ -1,102 +0,0 @@
1
- /*
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- import './style/withBackground.scss';
6
-
7
- import React, {CSSProperties, PropsWithChildren} from 'react';
8
- import classNames from 'classnames';
9
- import {escapePressed, hasHover} from "../util/controlUtil";
10
-
11
- interface Props {
12
- onClickBackground?: Function,
13
- onClose: Function;
14
- active: boolean;
15
- backgroundColor: string;
16
- transparent: boolean;
17
- backgroundClass: string;
18
- containerClass: string;
19
- escapeDisabled: boolean;
20
- preventBackgroundClick: boolean;
21
- zIndex?: number;
22
- }
23
-
24
- export default class WithBackground extends React.Component<PropsWithChildren<Props>> {
25
- static defaultProps = {
26
- backgroundColor: 'rgba(0,0,0,.2)',
27
- transparent: false,
28
- backgroundClass: '',
29
- containerClass: '',
30
- escapeDisabled: false,
31
- preventBackgroundClick: false,
32
- };
33
-
34
- contentContainer: HTMLDivElement | null = null;
35
- escapeListenerActive: boolean = false;
36
-
37
- onClickBackground = (evt: React.MouseEvent) => {
38
- const {onClickBackground, onClose, preventBackgroundClick} = this.props;
39
- if (!preventBackgroundClick) {
40
- if (onClickBackground) onClickBackground(evt);
41
- else if (this.contentContainer === null || !hasHover(this.contentContainer))
42
- onClose(evt);
43
- }
44
- };
45
-
46
- onKeyDown = (evt: KeyboardEvent) => {
47
- const {onClose, escapeDisabled} = this.props;
48
- if (escapePressed(evt) && !escapeDisabled) onClose();
49
- };
50
-
51
- getBackgroundStyle = (): CSSProperties => {
52
- const {backgroundColor, transparent, zIndex} = this.props,
53
- color = transparent ? 'transparent' : backgroundColor,
54
- style: CSSProperties = {backgroundColor: color};
55
- if (zIndex !== undefined) style.zIndex = zIndex;
56
- return style;
57
- };
58
-
59
- enableEscapeListener = () => {
60
- document.addEventListener('keydown', this.onKeyDown);
61
- this.escapeListenerActive = true;
62
- };
63
-
64
- disableEscapeListener = () => {
65
- document.removeEventListener('keydown', this.onKeyDown);
66
- this.escapeListenerActive = false;
67
- };
68
-
69
- componentDidMount = () => {
70
- const {active, escapeDisabled} = this.props;
71
- if (active && !escapeDisabled) this.enableEscapeListener();
72
- };
73
-
74
- componentDidUpdate = (prevProps: Props) => {
75
- const {active, escapeDisabled} = this.props;
76
- if (escapeDisabled && this.escapeListenerActive) this.disableEscapeListener();
77
- else if (!escapeDisabled) {
78
- if (prevProps.escapeDisabled && active) this.enableEscapeListener();
79
- else if (active && !prevProps.active) this.enableEscapeListener();
80
- else if (!active && prevProps.active) this.disableEscapeListener();
81
- }
82
- };
83
-
84
- componentWillUnmount = () => {
85
- this.disableEscapeListener();
86
- };
87
-
88
- render = () => {
89
- const {backgroundClass, containerClass, children, active} = this.props;
90
- if (!active) return null;
91
- return (
92
- <div className={classNames('with-background', backgroundClass)} onMouseDown={this.onClickBackground}
93
- style={this.getBackgroundStyle()}>
94
- <div className={classNames('content-container', containerClass)} ref={ref => {
95
- this.contentContainer = ref
96
- }}>
97
- {children}
98
- </div>
99
- </div>
100
- )
101
- };
102
- }
@@ -1,46 +0,0 @@
1
- /*
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
- import './style/asyncSelect.scss';
5
-
6
- import React from 'react';
7
- import {PureComponent} from 'react';
8
- import {SelectDefaultProps, SelectProps} from "../selectController";
9
- import {Loader, Select, generateComponentId} from "../../../..";
10
- import classNames from "classnames";
11
-
12
- interface Props extends SelectProps {
13
- onSearch: (value: string, callback: VoidFunction) => void;
14
- loading: boolean;
15
- }
16
-
17
- export default class AsyncSelect extends PureComponent<Props> {
18
- static defaultProps = SelectDefaultProps;
19
-
20
- private searchValue: string = '';
21
- private id: string = generateComponentId(this.props.id);
22
-
23
- onChangeSearch = (value: string) => {
24
- this.searchValue = value;
25
- };
26
-
27
- onEnter = () => {
28
- this.props.onSearch(this.searchValue, this.focusInput);
29
- };
30
-
31
- focusInput = () => {
32
- const input = document.getElementById(`${this.id}-input`);
33
- if (input) input.focus();
34
- };
35
-
36
- render = () => {
37
- const {loading, fullWidth} = this.props;
38
- return (
39
- <div className={classNames('dvr-async-select', fullWidth && 'fw')}>
40
- <Loader active={loading} containerClass='dvr-async-select-loader' size='2rem' disableBackground/>
41
- <Select {...this.props} onChangeSearch={this.onChangeSearch} onEnter={this.onEnter} disabled={loading}
42
- id={this.id} forceDisplayItems/>
43
- </div>
44
- )
45
- };
46
- }
@@ -1,23 +0,0 @@
1
- /*!
2
- * Copyright (c) 2021. Dave van Rijn Development
3
- */
4
-
5
- @import '../../../../style/variables';
6
-
7
- .dvr-async-select {
8
- display: inline-block;
9
- position: relative;
10
-
11
- .dvr-async-select-loader {
12
- position: absolute;
13
- right: 2.5rem;
14
- top: 1.2rem;
15
- width: min-content;
16
- height: auto;
17
- left: unset;
18
- }
19
-
20
- &.fw {
21
- width: 100%;
22
- }
23
- }