@idevs/corelib 0.0.97 → 1.0.1
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/CHANGELOG.md +743 -0
- package/README.md +221 -24
- package/dist/editors/checkboxButtonEditor.d.ts +3 -1
- package/dist/editors/checkboxButtonEditor.d.ts.map +1 -0
- package/dist/editors/checkboxButtonEditor.js +28 -18
- package/dist/editors/checkboxButtonEditor.js.map +1 -1
- package/dist/editors/dateMonthEditor.d.ts +3 -1
- package/dist/editors/dateMonthEditor.d.ts.map +1 -0
- package/dist/editors/dateMonthEditor.js +14 -7
- package/dist/editors/dateMonthEditor.js.map +1 -1
- package/dist/editors/index.d.ts +2 -1
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +18 -2
- package/dist/editors/index.js.map +1 -1
- package/dist/formatters/formatters.d.ts +2 -1
- package/dist/formatters/formatters.d.ts.map +1 -0
- package/dist/formatters/formatters.js +35 -23
- package/dist/formatters/formatters.js.map +1 -1
- package/dist/formatters/index.d.ts +2 -1
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +17 -1
- package/dist/formatters/index.js.map +1 -1
- package/dist/globals/index.d.ts +17 -10
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/index.js +65 -105
- package/dist/globals/index.js.map +1 -1
- package/dist/helpers/custom-fonts.d.ts +2 -1
- package/dist/helpers/custom-fonts.d.ts.map +1 -0
- package/dist/helpers/custom-fonts.js +4 -1
- package/dist/helpers/custom-fonts.js.map +1 -1
- package/dist/helpers/dialogHelper.d.ts +6 -9
- package/dist/helpers/dialogHelper.d.ts.map +1 -0
- package/dist/helpers/dialogHelper.js +17 -10
- package/dist/helpers/dialogHelper.js.map +1 -1
- package/dist/helpers/excelExportHelper.d.ts +2 -1
- package/dist/helpers/excelExportHelper.d.ts.map +1 -0
- package/dist/helpers/excelExportHelper.js +7 -4
- package/dist/helpers/excelExportHelper.js.map +1 -1
- package/dist/helpers/gridHelper.d.ts +2 -1
- package/dist/helpers/gridHelper.d.ts.map +1 -0
- package/dist/helpers/gridHelper.js +14 -9
- package/dist/helpers/gridHelper.js.map +1 -1
- package/dist/helpers/index.d.ts +2 -1
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +20 -4
- package/dist/helpers/index.js.map +1 -1
- package/dist/helpers/pdfExportHelper.d.ts +2 -1
- package/dist/helpers/pdfExportHelper.d.ts.map +1 -0
- package/dist/helpers/pdfExportHelper.js +83 -17
- package/dist/helpers/pdfExportHelper.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/types/common.d.ts +12 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +3 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/export.d.ts +50 -0
- package/dist/types/export.d.ts.map +1 -0
- package/dist/types/export.js +24 -0
- package/dist/types/export.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/DropdownToolButton.d.ts +2 -1
- package/dist/ui/DropdownToolButton.d.ts.map +1 -0
- package/dist/ui/DropdownToolButton.js +15 -11
- package/dist/ui/DropdownToolButton.js.map +1 -1
- package/dist/ui/ToggleToolButton.d.ts +2 -1
- package/dist/ui/ToggleToolButton.d.ts.map +1 -0
- package/dist/ui/ToggleToolButton.js +7 -3
- package/dist/ui/ToggleToolButton.js.map +1 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +18 -2
- package/dist/ui/index.js.map +1 -1
- package/dist/utils/date.d.ts +16 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +85 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/dom.d.ts +13 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/dom.js +78 -0
- package/dist/utils/dom.js.map +1 -0
- package/dist/utils/format.d.ts +22 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +100 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +48 -29
- package/dist/ui/ToolDropdownButton.d.ts +0 -49
- package/dist/ui/ToolDropdownButton.js +0 -230
- package/dist/ui/ToolDropdownButton.js.map +0 -1
- package/src/editors/checkboxButtonEditor.ts +0 -184
- package/src/editors/dateMonthEditor.ts +0 -47
- package/src/editors/index.ts +0 -2
- package/src/formatters/formatters.ts +0 -185
- package/src/formatters/index.ts +0 -1
- package/src/globals/index.ts +0 -385
- package/src/helpers/custom-fonts.d.ts +0 -5
- package/src/helpers/custom-fonts.ts +0 -18
- package/src/helpers/dialogHelper.ts +0 -143
- package/src/helpers/excelExportHelper.ts +0 -29
- package/src/helpers/gridHelper.ts +0 -107
- package/src/helpers/html2pdf.d.ts +0 -19
- package/src/helpers/index.ts +0 -4
- package/src/helpers/pdfExportHelper.ts +0 -179
- package/src/index.ts +0 -5
- package/src/tsconfig.json +0 -29
- package/src/ui/DropdownToolButton.ts +0 -305
- package/src/ui/ToggleToolButton.ts +0 -71
- package/src/ui/index.ts +0 -2
- /package/{css → dist/css}/idevs.dropdown.css +0 -0
- /package/{css → dist/css}/idevs.print.css +0 -0
package/src/globals/index.ts
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { DataGrid, ListRequest, ServiceResponse, ToolButton } from '@serenity-is/corelib'
|
|
2
|
-
import { isEmptyOrNull } from '@serenity-is/corelib'
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
6
|
-
interface Number {
|
|
7
|
-
toDecimal(precision?: number): string
|
|
8
|
-
toTimeString(): string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
12
|
-
interface String {
|
|
13
|
-
truncate(maxLength?: number): string
|
|
14
|
-
toNumber(): number
|
|
15
|
-
toMethodRound(method?: number): number
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
19
|
-
interface Date {
|
|
20
|
-
toSqlDate(): string
|
|
21
|
-
toNumber(): number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type IModalOptions = {
|
|
25
|
-
events?: IEvent[]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type IEvent = {
|
|
29
|
-
event: string
|
|
30
|
-
callback: (e: Event) => Promise<unknown>
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Date.prototype.toSqlDate = function (): string {
|
|
35
|
-
const date = this.valueOf()
|
|
36
|
-
return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
Date.prototype.toNumber = function (): number {
|
|
40
|
-
const date = this.valueOf()
|
|
41
|
-
const hours = date.getHours()
|
|
42
|
-
const minutes = date.getMinutes()
|
|
43
|
-
const seconds = date.getSeconds()
|
|
44
|
-
return hours * 60 + minutes + seconds / 60
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Number.prototype.toTimeString = function (): string {
|
|
48
|
-
const value = this.valueOf()
|
|
49
|
-
const hours = `0${Math.floor(value / 60)}`.slice(-2)
|
|
50
|
-
const minutes = `0${value % 60}`.slice(-2)
|
|
51
|
-
return `${hours}:${minutes}`
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
Number.prototype.toDecimal = function (precision?: number): string {
|
|
55
|
-
const numb = precision || 0
|
|
56
|
-
const options = {
|
|
57
|
-
minimumFractionDigits: numb,
|
|
58
|
-
maximumFractionDigits: numb,
|
|
59
|
-
}
|
|
60
|
-
let value = Intl.NumberFormat('en-US', options).format(this.valueOf())
|
|
61
|
-
value = parseFloat(value.replace(/,/g, '')).toString()
|
|
62
|
-
return Intl.NumberFormat('en-US', options).format(parseFloat(value))
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
String.prototype.truncate = function (maxLength: number) {
|
|
66
|
-
const str = String(this)
|
|
67
|
-
return str.length > maxLength ? str.substring(0, maxLength - 1) + '…' : str
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
String.prototype.toNumber = function () {
|
|
71
|
-
return this.valueOf() ? parseFloat(this.valueOf().replace(/,/g, '')) : 0
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
String.prototype.toMethodRound = function (method: number): number {
|
|
75
|
-
const input = parseFloat(this.valueOf())
|
|
76
|
-
let value = isNaN(input) ? 0 : input
|
|
77
|
-
if (value == 0) return 0
|
|
78
|
-
|
|
79
|
-
const r = parseFloat(value.toFixed(2))
|
|
80
|
-
switch (method) {
|
|
81
|
-
case 1:
|
|
82
|
-
value = r - (parseFloat(((r % 1) * 100).toFixed(2)) % 25) / 100
|
|
83
|
-
break
|
|
84
|
-
|
|
85
|
-
case 2:
|
|
86
|
-
value = r - (parseFloat(((r % 1) * 100).toFixed(2)) % 50) / 100
|
|
87
|
-
break
|
|
88
|
-
|
|
89
|
-
case 3:
|
|
90
|
-
value = Math.floor(r)
|
|
91
|
-
break
|
|
92
|
-
|
|
93
|
-
case 4:
|
|
94
|
-
value = Math.floor(r) + (Math.floor((r % 1) * 100) + (25 - (Math.floor((r % 1) * 100) % 25))) / 100
|
|
95
|
-
break
|
|
96
|
-
|
|
97
|
-
case 5:
|
|
98
|
-
value = Math.floor(r) + (Math.floor((r % 1) * 100) + (50 - (Math.floor((r % 1) * 100) % 50))) / 100
|
|
99
|
-
break
|
|
100
|
-
|
|
101
|
-
case 6:
|
|
102
|
-
value = Math.ceil(r)
|
|
103
|
-
break
|
|
104
|
-
|
|
105
|
-
case 7:
|
|
106
|
-
value = Math.floor(r) + (parseFloat((parseFloat(((r % 1) * 100).toString()) / 25).toFixed(0)) * 25) / 100
|
|
107
|
-
break
|
|
108
|
-
|
|
109
|
-
case 8:
|
|
110
|
-
value = Math.floor(r) + (parseFloat((parseFloat(((r % 1) * 100).toString()) / 50).toFixed(0)) * 50) / 100
|
|
111
|
-
break
|
|
112
|
-
|
|
113
|
-
case 9:
|
|
114
|
-
value = parseFloat(r.toFixed(0))
|
|
115
|
-
break
|
|
116
|
-
|
|
117
|
-
default:
|
|
118
|
-
value = r
|
|
119
|
-
break
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return value
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function ToTimeString(value: number): string {
|
|
126
|
-
const hours = `0${Math.floor(value / 60)}`.slice(-2)
|
|
127
|
-
const minutes = `0${value % 60}`.slice(-2)
|
|
128
|
-
return `${hours}:${minutes}`
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function ToNumber(date: Date): number {
|
|
132
|
-
const hours = date.getHours()
|
|
133
|
-
const minutes = date.getMinutes()
|
|
134
|
-
const seconds = date.getSeconds()
|
|
135
|
-
return hours * 60 + minutes * 60 + seconds
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function GetElementWidth(element?: HTMLElement): number {
|
|
139
|
-
if (element) {
|
|
140
|
-
return element.clientWidth
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function GetElementHeight(element?: HTMLElement): number {
|
|
147
|
-
if (element) {
|
|
148
|
-
return element.clientHeight
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export function RemoveChildren(parent?: HTMLElement): void {
|
|
155
|
-
if (!parent) {
|
|
156
|
-
return
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
while (parent.firstChild) {
|
|
160
|
-
parent.removeChild(parent.firstChild)
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function IsOverflow(el: HTMLElement): boolean {
|
|
165
|
-
return el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function IsOverflowY(el: HTMLElement): boolean {
|
|
169
|
-
return el.scrollHeight > el.clientHeight
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function IsOverflowX(el: HTMLElement): boolean {
|
|
173
|
-
return el.scrollWidth > el.clientWidth
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function InnerDimensions(el: HTMLElement | null): [number, number] {
|
|
177
|
-
if (!el) {
|
|
178
|
-
return [0, 0]
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const style = getComputedStyle(el)
|
|
182
|
-
let width = el.clientWidth
|
|
183
|
-
let height = el.clientHeight
|
|
184
|
-
|
|
185
|
-
height -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)
|
|
186
|
-
width -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight)
|
|
187
|
-
|
|
188
|
-
return [height, width]
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function neededTarget(el: HTMLElement, target: string): HTMLElement {
|
|
192
|
-
if (target.slice(0, 1) == '.') {
|
|
193
|
-
if (el.classList.contains(target.slice(1)) === false) {
|
|
194
|
-
el = el.closest(target) as HTMLElement
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
if (el.tagName.toLowerCase() !== target.toLowerCase()) {
|
|
198
|
-
el = el.closest(target) as HTMLElement
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return el
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function dateStringOption(): Intl.DateTimeFormatOptions {
|
|
205
|
-
return {
|
|
206
|
-
year: 'numeric',
|
|
207
|
-
month: '2-digit',
|
|
208
|
-
day: '2-digit',
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export function toDateString(date: Date): string {
|
|
213
|
-
return date.toLocaleString('en-GB', dateStringOption())
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// export function GetModal(name: string, options?: IModalOptions): Modal {
|
|
217
|
-
// const el = document.querySelector(name) as HTMLElement
|
|
218
|
-
// if (options?.events?.length) {
|
|
219
|
-
// options.events.forEach(callback => {
|
|
220
|
-
// el.addEventListener(
|
|
221
|
-
// callback.event,
|
|
222
|
-
// (e: Event) => {
|
|
223
|
-
// callback.callback(e)
|
|
224
|
-
// },
|
|
225
|
-
// { once: true },
|
|
226
|
-
// )
|
|
227
|
-
// })
|
|
228
|
-
// }
|
|
229
|
-
|
|
230
|
-
// return Modal.getOrCreateInstance(el, { backdrop: 'static' })
|
|
231
|
-
// }
|
|
232
|
-
|
|
233
|
-
export const setCookie = (name: string, value: string, expires?: number): void => {
|
|
234
|
-
let cookie = `${name}=${value}`
|
|
235
|
-
if (expires) {
|
|
236
|
-
const date = new Date()
|
|
237
|
-
date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1000)
|
|
238
|
-
const exp = `expires=${date.toUTCString()}`
|
|
239
|
-
cookie = `${cookie}; ${exp}`
|
|
240
|
-
}
|
|
241
|
-
document.cookie = `${cookie}; path=/`
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export type dateProxyInputOption = {
|
|
245
|
-
name: string
|
|
246
|
-
readOnly?: boolean
|
|
247
|
-
width?: number
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export function addDateProxyInput(opt: dateProxyInputOption): HTMLInputElement {
|
|
251
|
-
const input: HTMLInputElement = document.querySelector(`input[name="${opt.name}"]`)
|
|
252
|
-
const cloneInput: HTMLInputElement = input.cloneNode(true) as HTMLInputElement
|
|
253
|
-
cloneInput.setAttribute('name', `${opt.name}-2`)
|
|
254
|
-
cloneInput.setAttribute('id', `${input.getAttribute('id')}-2`)
|
|
255
|
-
cloneInput.setAttribute('readonly', 'readonly')
|
|
256
|
-
cloneInput.classList.remove('customValidate')
|
|
257
|
-
cloneInput.classList.remove('s-DateEditor')
|
|
258
|
-
cloneInput.classList.remove('s-Serenity-DateEditor')
|
|
259
|
-
cloneInput.classList.remove('dateQ')
|
|
260
|
-
cloneInput.classList.remove('hasDatepicker')
|
|
261
|
-
if (opt.readOnly) {
|
|
262
|
-
cloneInput.style.backgroundColor = 'rgba(var(--s-bright-rgb), 0.02)'
|
|
263
|
-
} else {
|
|
264
|
-
cloneInput.style.backgroundColor = 'white'
|
|
265
|
-
}
|
|
266
|
-
if (opt.width) {
|
|
267
|
-
cloneInput.style.width = `${opt.width}px`
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
input.parentNode.insertBefore(cloneInput, input.nextSibling)
|
|
271
|
-
input.classList.add('d-none')
|
|
272
|
-
|
|
273
|
-
return cloneInput
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export function updateDateProxyValue(name: string, dateValue: string | Date | null, locale?: string): void {
|
|
277
|
-
let target = document.querySelector(`#${name}-2`) as HTMLInputElement
|
|
278
|
-
if (!target) {
|
|
279
|
-
target = document.querySelector(`input[name=${name}-2]`) as HTMLInputElement
|
|
280
|
-
}
|
|
281
|
-
if (isEmptyOrNull(dateValue?.toString())) {
|
|
282
|
-
target.value = ''
|
|
283
|
-
} else {
|
|
284
|
-
if (!locale) {
|
|
285
|
-
locale = 'en-GB'
|
|
286
|
-
}
|
|
287
|
-
target.value = (dateValue.constructor == Date ? dateValue : new Date(dateValue)).toLocaleString(
|
|
288
|
-
locale,
|
|
289
|
-
dateStringOption(),
|
|
290
|
-
)
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
export function toSqlDateString(date: Date): string {
|
|
295
|
-
const offset = date.getTimezoneOffset()
|
|
296
|
-
date = new Date(date.getTime() - offset * 60 * 1000)
|
|
297
|
-
return date.toISOString().split('T')[0]
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export enum PageSizes {
|
|
301
|
-
A4 = 0,
|
|
302
|
-
A3 = 1,
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export enum PageOrientations {
|
|
306
|
-
Portrait = 0,
|
|
307
|
-
Landscape = 1,
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export type PageSize = {
|
|
311
|
-
Size: PageSize
|
|
312
|
-
Orientation: PageOrientations
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export type PageMargin = {
|
|
316
|
-
MarginLeft: string
|
|
317
|
-
MarginTop: string
|
|
318
|
-
MarginRight: string
|
|
319
|
-
MarginBottom: string
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export type IdevsExportRequest = ListRequest & {
|
|
323
|
-
viewName?: string
|
|
324
|
-
companyName?: string
|
|
325
|
-
reportName?: string
|
|
326
|
-
selectionRange?: string
|
|
327
|
-
conditionRange?: string
|
|
328
|
-
logo?: string
|
|
329
|
-
pageSize?: PageSize
|
|
330
|
-
margin?: PageMargin
|
|
331
|
-
entity?: unknown
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export type IdevsExportOptions = IdevsExportRequest & {
|
|
335
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
336
|
-
grid: DataGrid<any, any>
|
|
337
|
-
service: string
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
export type ExportOptions = IdevsExportOptions & {
|
|
341
|
-
title?: string
|
|
342
|
-
hint?: string
|
|
343
|
-
separator?: boolean
|
|
344
|
-
exportType: 'PDF' | 'XLSX'
|
|
345
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
346
|
-
onClick?: (e: any) => void
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export type IdevsContentResponse = ServiceResponse & {
|
|
350
|
-
Content: string
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export function createExportToolButton(options: ExportOptions): ToolButton {
|
|
354
|
-
return {
|
|
355
|
-
hint: options.hint || options.exportType,
|
|
356
|
-
title: options.title || '',
|
|
357
|
-
cssClass: `export-${options.exportType.toLowerCase()}-button`,
|
|
358
|
-
onClick: options.onClick,
|
|
359
|
-
separator: options.separator,
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export function toBeginMonth(date: string): string {
|
|
364
|
-
if (isEmptyOrNull(date)) {
|
|
365
|
-
return date
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return `${date.substring(0, 8)}01`
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export function toEndMonth(date: string): string {
|
|
372
|
-
if (isEmptyOrNull(date)) {
|
|
373
|
-
return date
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const dateArr = date.split('-')
|
|
377
|
-
const d = new Date(parseInt(dateArr[0]), parseInt(dateArr[1]), 0)
|
|
378
|
-
|
|
379
|
-
return `${date.substring(0, 8)}${d.getDate()}`
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export class globals {
|
|
383
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
384
|
-
public static load() {}
|
|
385
|
-
}
|