@colijnit/sharedcomponents 1.0.23 → 1.0.25
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/.browserslistrc +16 -0
- package/.editorconfig +16 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +11 -8
- package/Sharedcomponents.iml +11 -0
- package/angular.json +133 -0
- package/karma.conf.js +44 -0
- package/move-assets.js +14 -0
- package/package.json +74 -26
- package/projects/sharedcomponents/.browserslistrc +16 -0
- package/projects/sharedcomponents/README.md +24 -0
- package/projects/sharedcomponents/karma.conf.js +44 -0
- package/projects/sharedcomponents/ng-package.json +17 -0
- package/projects/sharedcomponents/package.json +18 -0
- package/projects/sharedcomponents/src/lib/assets/dictionary/text.properties.ts +8 -0
- package/projects/sharedcomponents/src/lib/assets/icons/angle_left_solid.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/angle_right_solid.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/arrow_fat_right.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/arrow_point_left.svg +8 -0
- package/projects/sharedcomponents/src/lib/assets/icons/arrow_point_right.svg +4 -0
- package/projects/sharedcomponents/src/lib/assets/icons/bring_forward_regular.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/check_round.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/delete_left_regular.svg +1 -0
- package/projects/sharedcomponents/src/lib/assets/icons/delivery_truck.svg +12 -0
- package/projects/sharedcomponents/src/lib/assets/icons/email.svg +5 -0
- package/projects/sharedcomponents/src/lib/assets/icons/pdf.svg +15 -0
- package/projects/sharedcomponents/src/lib/assets/icons/print.svg +10 -0
- package/projects/sharedcomponents/src/lib/assets/icons/signature_field.svg +9 -0
- package/projects/sharedcomponents/src/lib/assets/icons/xml.svg +9 -0
- package/projects/sharedcomponents/src/lib/components/circular-gauge/co-circular-gauge.component.ts +139 -0
- package/projects/sharedcomponents/src/lib/components/circular-gauge/co-circular-gauge.module.ts +19 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/circular-gauge/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/circular-gauge/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/circular-gauge/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/circular-gauge/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-base-view.component.ts +68 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-day-view.component.ts +31 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-event.component.ts +67 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-events.component.ts +48 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-half-hour-cell.component.ts +81 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-header.component.ts +265 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-hour-cell.component.ts +38 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-hour-view-labels.component.ts +50 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-hour-view.component.ts +46 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-month-view.component.ts +65 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-view.component.ts +38 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-week-select-view.component.ts +63 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/agenda-week-view.component.ts +46 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/style/_layout.scss +443 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/style/_material-definition.scss +11 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/agenda/style/_theme.scss +7 -0
- package/{lib/components/layout-switcher → projects/sharedcomponents/src/lib/components/date-planning/component/agenda}/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/calendar-all-months.component.ts +37 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/calendar-all-years.component.ts +52 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/calendar-header.component.ts +124 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/calendar-view.component.ts +201 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/calendar.component.ts +35 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/style/_layout.scss +167 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/style/_material-definition.scss +7 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/component/calendar/style/_theme.scss +7 -0
- package/{lib/components/linear-gauge → projects/sharedcomponents/src/lib/components/date-planning/component/calendar}/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/date-planning.component.ts +133 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/date-planning.module.ts +56 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/style/_layout.scss +47 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/style/_material-definition.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/style/_theme.scss +7 -0
- package/projects/sharedcomponents/src/lib/components/date-planning/style/material.scss +5 -0
- package/projects/sharedcomponents/src/lib/components/docsign/component/signature/signature.component.ts +82 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signature/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signature/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signature/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signature/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/docsign/component/signatures/signatures.component.ts +50 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signatures/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signatures/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signatures/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/component/signatures/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/docsign/docsign.component.ts +252 -0
- package/projects/sharedcomponents/src/lib/components/docsign/docsign.module.ts +22 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/docsign/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/key-pad/key-pad.component.ts +205 -0
- package/projects/sharedcomponents/src/lib/components/key-pad/key-pad.module.ts +19 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/key-pad/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/key-pad/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/key-pad/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/key-pad/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/layout-switcher/layout-switcher.component.ts +98 -0
- package/projects/sharedcomponents/src/lib/components/layout-switcher/layout-switcher.module.ts +21 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/layout-switcher/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/layout-switcher/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/layout-switcher/style/_theme.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/layout-switcher/style/material.scss +5 -0
- package/projects/sharedcomponents/src/lib/components/linear-gauge/co-linear-gauge.component.ts +56 -0
- package/projects/sharedcomponents/src/lib/components/linear-gauge/co-linear-gauge.module.ts +17 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/linear-gauge/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/linear-gauge/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/linear-gauge/style/_theme.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/linear-gauge/style/material.scss +5 -0
- package/projects/sharedcomponents/src/lib/components/send-method-dialog/enums/send-option.ts +6 -0
- package/projects/sharedcomponents/src/lib/components/send-method-dialog/send-method-dialog.component.ts +342 -0
- package/projects/sharedcomponents/src/lib/components/send-method-dialog/send-method-dialog.module.ts +33 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/send-method-dialog/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/send-method-dialog/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/send-method-dialog/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/send-method-dialog/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/statusbar/statusbar.component.ts +97 -0
- package/projects/sharedcomponents/src/lib/components/statusbar/statusbar.module.ts +21 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/statusbar/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/statusbar/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/statusbar/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/statusbar/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock-in-order/stock-in-order.component.ts +0 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock-information/stock-information.component.ts +64 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock-information-grid/stock-information-grid.component.ts +384 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock-location/stock-location.component.ts +84 -0
- package/{lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.d.ts → projects/sharedcomponents/src/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.ts} +2 -2
- package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/stock-change-amount.component.ts +73 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock-transfer/stock-transfer.component.ts +153 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock.component.ts +165 -0
- package/projects/sharedcomponents/src/lib/components/stock/stock.module.ts +51 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/stock/style/_layout.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/stock/style/_material-definition.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/stock/style/_theme.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/components/stock/style/material.scss +0 -0
- package/projects/sharedcomponents/src/lib/enum/calendar-view.enum.ts +6 -0
- package/{lib/enum/icon.enum.d.ts → projects/sharedcomponents/src/lib/enum/icon.enum.ts} +5 -2
- package/projects/sharedcomponents/src/lib/enum/keyboard-code.enum.ts +30 -0
- package/projects/sharedcomponents/src/lib/enum/language-code.enum.ts +6 -0
- package/projects/sharedcomponents/src/lib/enum/month.enum.ts +15 -0
- package/projects/sharedcomponents/src/lib/enum/time-period.enum.ts +9 -0
- package/projects/sharedcomponents/src/lib/factory/business-object-factory.ts +120 -0
- package/projects/sharedcomponents/src/lib/factory/decorators/boolean.decorator.ts +113 -0
- package/projects/sharedcomponents/src/lib/factory/decorators/complex-array.decorator.ts +61 -0
- package/projects/sharedcomponents/src/lib/factory/decorators/complex-field.decorator.ts +63 -0
- package/projects/sharedcomponents/src/lib/factory/decorators/date-field.decorator.ts +41 -0
- package/projects/sharedcomponents/src/lib/factory/decorators/string-number.decorator.ts +48 -0
- package/projects/sharedcomponents/src/lib/model/agenda-event-per-day.model.ts +6 -0
- package/projects/sharedcomponents/src/lib/model/agenda-event.model.ts +17 -0
- package/projects/sharedcomponents/src/lib/model/agenda-null-objects.ts +11 -0
- package/projects/sharedcomponents/src/lib/model/business-object.ts +85 -0
- package/projects/sharedcomponents/src/lib/model/constant/all-months.ts +17 -0
- package/projects/sharedcomponents/src/lib/model/date-range.ts +10 -0
- package/projects/sharedcomponents/src/lib/model/day.model.ts +9 -0
- package/projects/sharedcomponents/src/lib/model/icon-svg.ts +18 -0
- package/projects/sharedcomponents/src/lib/model/month.model.ts +11 -0
- package/projects/sharedcomponents/src/lib/model/time-window.bo.ts +21 -0
- package/projects/sharedcomponents/src/lib/model/week.model.ts +5 -0
- package/projects/sharedcomponents/src/lib/model/weekday.model.ts +17 -0
- package/projects/sharedcomponents/src/lib/pipe/array-number.pipe.ts +14 -0
- package/projects/sharedcomponents/src/lib/pipe/master-pipes.ts +7 -0
- package/projects/sharedcomponents/src/lib/pipe/ucfirst.pipe.ts +14 -0
- package/projects/sharedcomponents/src/lib/service/dictionary.service.ts +86 -0
- package/projects/sharedcomponents/src/lib/service/icon-cache.service.ts +51 -0
- package/projects/sharedcomponents/src/lib/service/options.service.ts +66 -0
- package/projects/sharedcomponents/src/lib/service/shared-connector.service.ts +258 -0
- package/projects/sharedcomponents/src/lib/service/shared-initializer.service.ts +29 -0
- package/projects/sharedcomponents/src/lib/service/shared.service.ts +21 -0
- package/projects/sharedcomponents/src/lib/service/stock.service.ts +95 -0
- package/{lib → projects/sharedcomponents/src/lib}/style/_mixin.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/style/_variables.scss +0 -0
- package/{lib → projects/sharedcomponents/src/lib}/style/sharedcomponents-globals.scss +0 -0
- package/projects/sharedcomponents/src/lib/utils/array-utils.ts +202 -0
- package/projects/sharedcomponents/src/lib/utils/calendar.utils.ts +75 -0
- package/projects/sharedcomponents/src/lib/utils/date-utils.ts +302 -0
- package/projects/sharedcomponents/src/lib/utils/function/not-nill.function.ts +4 -0
- package/projects/sharedcomponents/src/lib/utils/is-nill.function.ts +4 -0
- package/projects/sharedcomponents/src/lib/utils/string-utils.ts +67 -0
- package/{public-api.d.ts → projects/sharedcomponents/src/public-api.ts} +5 -0
- package/projects/sharedcomponents/src/test.ts +27 -0
- package/projects/sharedcomponents/tsconfig.lib.json +18 -0
- package/projects/sharedcomponents/tsconfig.lib.prod.json +10 -0
- package/projects/sharedcomponents/tsconfig.spec.json +17 -0
- package/script/merge-icons.js +39 -0
- package/src/app/app.component.scss +9 -0
- package/src/app/app.component.spec.ts +31 -0
- package/src/app/app.component.ts +156 -0
- package/src/app/app.module.ts +60 -0
- package/src/assets/.gitkeep +0 -0
- package/src/environments/environment.prod.ts +3 -0
- package/src/environments/environment.ts +16 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +13 -0
- package/src/main.ts +12 -0
- package/src/polyfills.ts +53 -0
- package/src/styles.scss +40 -0
- package/src/test.ts +26 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +65 -0
- package/tsconfig.spec.json +18 -0
- package/bundles/colijnit-sharedcomponents.umd.js +0 -3701
- package/bundles/colijnit-sharedcomponents.umd.js.map +0 -1
- package/colijnit-sharedcomponents-1.0.23.tgz +0 -0
- package/colijnit-sharedcomponents.d.ts +0 -16
- package/colijnit-sharedcomponents.metadata.json +0 -1
- package/esm2015/colijnit-sharedcomponents.js +0 -17
- package/esm2015/lib/assets/dictionary/text.properties.js +0 -11
- package/esm2015/lib/components/circular-gauge/co-circular-gauge.component.js +0 -125
- package/esm2015/lib/components/circular-gauge/co-circular-gauge.module.js +0 -21
- package/esm2015/lib/components/docsign/component/signature/signature.component.js +0 -75
- package/esm2015/lib/components/docsign/component/signatures/signatures.component.js +0 -44
- package/esm2015/lib/components/docsign/docsign.component.js +0 -225
- package/esm2015/lib/components/docsign/docsign.module.js +0 -23
- package/esm2015/lib/components/key-pad/key-pad.component.js +0 -191
- package/esm2015/lib/components/key-pad/key-pad.module.js +0 -21
- package/esm2015/lib/components/layout-switcher/layout-switcher.component.js +0 -74
- package/esm2015/lib/components/layout-switcher/layout-switcher.module.js +0 -21
- package/esm2015/lib/components/linear-gauge/co-linear-gauge.component.js +0 -55
- package/esm2015/lib/components/linear-gauge/co-linear-gauge.module.js +0 -19
- package/esm2015/lib/components/send-method-dialog/enums/send-option.js +0 -8
- package/esm2015/lib/components/send-method-dialog/send-method-dialog.component.js +0 -309
- package/esm2015/lib/components/send-method-dialog/send-method-dialog.module.js +0 -31
- package/esm2015/lib/components/statusbar/statusbar.component.js +0 -81
- package/esm2015/lib/components/statusbar/statusbar.module.js +0 -23
- package/esm2015/lib/components/stock/stock-information/stock-information.component.js +0 -54
- package/esm2015/lib/components/stock/stock-information-grid/stock-information-grid.component.js +0 -350
- package/esm2015/lib/components/stock/stock-location/stock-location.component.js +0 -62
- package/esm2015/lib/components/stock/stock-transfer/co-drop-down-list-fields.interface.js +0 -2
- package/esm2015/lib/components/stock/stock-transfer/stock-change-amount.component.js +0 -68
- package/esm2015/lib/components/stock/stock-transfer/stock-transfer.component.js +0 -130
- package/esm2015/lib/components/stock/stock.component.js +0 -140
- package/esm2015/lib/components/stock/stock.module.js +0 -48
- package/esm2015/lib/enum/icon.enum.js +0 -17
- package/esm2015/lib/enum/keyboard-code.enum.js +0 -32
- package/esm2015/lib/enum/language-code.enum.js +0 -8
- package/esm2015/lib/factory/business-object-factory.js +0 -120
- package/esm2015/lib/factory/decorators/boolean.decorator.js +0 -102
- package/esm2015/lib/factory/decorators/complex-array.decorator.js +0 -55
- package/esm2015/lib/factory/decorators/complex-field.decorator.js +0 -57
- package/esm2015/lib/factory/decorators/date-field.decorator.js +0 -36
- package/esm2015/lib/factory/decorators/string-number.decorator.js +0 -43
- package/esm2015/lib/model/business-object.js +0 -81
- package/esm2015/lib/model/icon-svg.js +0 -16
- package/esm2015/lib/service/dictionary.service.js +0 -76
- package/esm2015/lib/service/icon-cache.service.js +0 -51
- package/esm2015/lib/service/options.service.js +0 -71
- package/esm2015/lib/service/shared-connector.service.js +0 -278
- package/esm2015/lib/service/shared.service.js +0 -30
- package/esm2015/lib/service/stock.service.js +0 -95
- package/esm2015/lib/utils/array-utils.js +0 -183
- package/esm2015/lib/utils/is-nill.function.js +0 -5
- package/esm2015/lib/utils/string-utils.js +0 -64
- package/esm2015/public-api.js +0 -21
- package/fesm2015/colijnit-sharedcomponents.js +0 -3511
- package/fesm2015/colijnit-sharedcomponents.js.map +0 -1
- package/lib/assets/dictionary/text.properties.d.ts +0 -3
- package/lib/components/circular-gauge/co-circular-gauge.component.d.ts +0 -20
- package/lib/components/circular-gauge/co-circular-gauge.module.d.ts +0 -2
- package/lib/components/docsign/component/signature/signature.component.d.ts +0 -16
- package/lib/components/docsign/component/signatures/signatures.component.d.ts +0 -12
- package/lib/components/docsign/docsign.component.d.ts +0 -92
- package/lib/components/docsign/docsign.module.d.ts +0 -2
- package/lib/components/key-pad/key-pad.component.d.ts +0 -36
- package/lib/components/key-pad/key-pad.module.d.ts +0 -2
- package/lib/components/layout-switcher/layout-switcher.component.d.ts +0 -16
- package/lib/components/layout-switcher/layout-switcher.module.d.ts +0 -2
- package/lib/components/linear-gauge/co-linear-gauge.component.d.ts +0 -16
- package/lib/components/linear-gauge/co-linear-gauge.module.d.ts +0 -2
- package/lib/components/send-method-dialog/enums/send-option.d.ts +0 -6
- package/lib/components/send-method-dialog/send-method-dialog.component.d.ts +0 -62
- package/lib/components/send-method-dialog/send-method-dialog.module.d.ts +0 -2
- package/lib/components/statusbar/statusbar.component.d.ts +0 -23
- package/lib/components/statusbar/statusbar.module.d.ts +0 -2
- package/lib/components/stock/stock-information/stock-information.component.d.ts +0 -10
- package/lib/components/stock/stock-information-grid/stock-information-grid.component.d.ts +0 -60
- package/lib/components/stock/stock-location/stock-location.component.d.ts +0 -15
- package/lib/components/stock/stock-transfer/stock-change-amount.component.d.ts +0 -18
- package/lib/components/stock/stock-transfer/stock-transfer.component.d.ts +0 -36
- package/lib/components/stock/stock.component.d.ts +0 -42
- package/lib/components/stock/stock.module.d.ts +0 -2
- package/lib/enum/keyboard-code.enum.d.ts +0 -30
- package/lib/enum/language-code.enum.d.ts +0 -6
- package/lib/factory/business-object-factory.d.ts +0 -23
- package/lib/factory/decorators/boolean.decorator.d.ts +0 -43
- package/lib/factory/decorators/complex-array.decorator.d.ts +0 -25
- package/lib/factory/decorators/complex-field.decorator.d.ts +0 -25
- package/lib/factory/decorators/date-field.decorator.d.ts +0 -17
- package/lib/factory/decorators/string-number.decorator.d.ts +0 -22
- package/lib/model/business-object.d.ts +0 -7
- package/lib/model/icon-svg.d.ts +0 -4
- package/lib/service/dictionary.service.d.ts +0 -21
- package/lib/service/icon-cache.service.d.ts +0 -18
- package/lib/service/options.service.d.ts +0 -13
- package/lib/service/shared-connector.service.d.ts +0 -43
- package/lib/service/shared.service.d.ts +0 -8
- package/lib/service/stock.service.d.ts +0 -38
- package/lib/utils/array-utils.d.ts +0 -57
- package/lib/utils/is-nill.function.d.ts +0 -1
- package/lib/utils/string-utils.d.ts +0 -22
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import {ObjectUtils} from "@colijnit/articleapi/build/utils/object-utils";
|
|
2
|
+
import {NumberUtils} from "@colijnit/articleapi/build/utils/number-utils";
|
|
3
|
+
import {isNill} from "@colijnit/articleapi/build/utils/function/is-nill.function";
|
|
4
|
+
import {notNill} from "@colijnit/articleapi/build/utils/function/not-nill.function";
|
|
5
|
+
|
|
6
|
+
export class ArrayUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether at least one element in given array could be found by given finder function.
|
|
9
|
+
*
|
|
10
|
+
* @param {T[]} array
|
|
11
|
+
* @param {(element: T) => boolean} finder A finder function that takes an element of the array and returns a boolean that represents
|
|
12
|
+
* the 'found status' for that element; whether it should have been found or not.
|
|
13
|
+
*/
|
|
14
|
+
public static ContainsAnElementFoundBy<T>(array: T[], finder: (element: T) => boolean): boolean {
|
|
15
|
+
if (!array || !finder) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return notNill(this.Find<T>(array, finder));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Cross-browser Array.find() function. Returns the first item in given array for which the foundBy function returns true. Returns
|
|
24
|
+
* undefined when none was found.
|
|
25
|
+
*
|
|
26
|
+
* Example usage:
|
|
27
|
+
* const foundItem: BusinessObject = ArrayUtils.Find<BusinessObject>(modelArray, (modelItem: BusinessObject) => <br>
|
|
28
|
+
* (return modelItem.getId() === '1')
|
|
29
|
+
* * });
|
|
30
|
+
*
|
|
31
|
+
* @param array The array with items to search in.
|
|
32
|
+
* @param foundBy The finder function applied on each items of the array, when that returns true, the item is considered found.
|
|
33
|
+
*/
|
|
34
|
+
public static Find<T>(array: T[], foundBy: (item: T) => boolean): T {
|
|
35
|
+
if (!array || !foundBy) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
40
|
+
const itemCur: T = array[i];
|
|
41
|
+
if (foundBy(itemCur) ) {
|
|
42
|
+
return itemCur;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// @returns empty array when nothing found, otherwise array with found items
|
|
49
|
+
public static FindAll<T>(array: T[], foundBy: (item: T) => boolean): T[] {
|
|
50
|
+
const answer: T[] = [];
|
|
51
|
+
if (!array || !foundBy) {
|
|
52
|
+
return answer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
56
|
+
const itemCur: T = array[i];
|
|
57
|
+
if (foundBy(itemCur)) {
|
|
58
|
+
answer.push(itemCur);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return answer;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// returns a simple clone of given array, using array.slice(0)
|
|
65
|
+
public static CloneArray<T>(array: T[]): T[] {
|
|
66
|
+
let answer: T[] = [];
|
|
67
|
+
|
|
68
|
+
if (array) {
|
|
69
|
+
answer = array.slice(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return answer;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns a 'semi deep clone' of given array. Its first-level members are object-shallow-cloned (optionally with a strongly typed constructor),
|
|
77
|
+
* or just as plain object (see param arrayItemsClass).
|
|
78
|
+
* @param array
|
|
79
|
+
* @param arrayItemsClass If provided, the cloned array's first-level items will be strongly typed to / constructed as this class. Otherwise
|
|
80
|
+
* it'll be a plain object.
|
|
81
|
+
* @param deepClone Set to true if array items contain FUNCTIONS that need to be cloned..
|
|
82
|
+
* @returns {Array} semi-deep clone of given array
|
|
83
|
+
*/
|
|
84
|
+
public static CloneArrayAndItsItems<T>(array: T[], arrayItemsClass?: any, deepClone: boolean = false): T[] {
|
|
85
|
+
const cloneArray: T[] = [];
|
|
86
|
+
|
|
87
|
+
if (array) {
|
|
88
|
+
for (let i: number = 0, len: number = array.length; i < len; i++) {
|
|
89
|
+
if (deepClone) {
|
|
90
|
+
cloneArray.push(ObjectUtils.GetDeepClone(array[i]));
|
|
91
|
+
} else {
|
|
92
|
+
cloneArray.push(ObjectUtils.GetShallowClone(array[i], arrayItemsClass));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return cloneArray;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Removes element at given index from given array. Doesn't just set it to null like JavaScripts standard 'delete' does, but really
|
|
104
|
+
* removes the element using splice().
|
|
105
|
+
*
|
|
106
|
+
* @param {number} index
|
|
107
|
+
* @param {any[]} array in-out
|
|
108
|
+
* @returns {boolean} True if and only if the element on given index is succesfully removed from given array.
|
|
109
|
+
*/
|
|
110
|
+
public static RemoveElementAtIndex(index: number, array: any[]): boolean {
|
|
111
|
+
if (NumberUtils.IsNaN(index) || index < 0 || !Array.isArray(array) || array.length === 0) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (index in array) {
|
|
116
|
+
array.splice(index, 1);
|
|
117
|
+
return true;
|
|
118
|
+
} else {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Removes given element from given array. Doesn't just set it to null like JavaScripts standard 'delete' does, but really removes the
|
|
125
|
+
* element using splice(). Also works on associative arrays.
|
|
126
|
+
*
|
|
127
|
+
* @param {T} element The element to remove.
|
|
128
|
+
* @param {T[]} array The array to remove the element from.
|
|
129
|
+
* @returns {boolean} True iff given element was truly successfully removed from given array.
|
|
130
|
+
*/
|
|
131
|
+
public static RemoveElement<T>(element: T, array: T[]): boolean {
|
|
132
|
+
if (!Array.isArray(array)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const index: number = array.indexOf(element);
|
|
137
|
+
return ArrayUtils.RemoveElementAtIndex(index, array);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Checks if given array is defined, and is an array, and has length > 0, and, optionally checks that the first element is of type given clazz.
|
|
141
|
+
public static IsArrayWithElements<T>(arrayToCheck: T[], classItemsMustBeInstanceOf?: any): boolean {
|
|
142
|
+
if (isNill(arrayToCheck)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (Array.isArray(arrayToCheck) && arrayToCheck.length > 0) {
|
|
147
|
+
if (classItemsMustBeInstanceOf) {
|
|
148
|
+
return arrayToCheck[0] instanceof classItemsMustBeInstanceOf;
|
|
149
|
+
} else {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Removes all elements from given array for which given filter function holds true. Returns true if at least one removed, else false.
|
|
158
|
+
public static RemoveElementsByFilter(array: any[], filterFunction: (item: any) => boolean): boolean {
|
|
159
|
+
if (!ArrayUtils.IsArrayWithElements(array) || !filterFunction) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
let atLeastOneRemoved: boolean = false;
|
|
164
|
+
|
|
165
|
+
const len: number = array.length;
|
|
166
|
+
for (let i: number = len - 1; i >= 0; i--) {
|
|
167
|
+
const item: any = array[i];
|
|
168
|
+
if (filterFunction.call(this, item) === true) {
|
|
169
|
+
array.splice(i, 1);
|
|
170
|
+
atLeastOneRemoved = true;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return atLeastOneRemoved;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public static MoveElement<T>(element: T, toIndex: number, array: T[]): boolean {
|
|
178
|
+
if (!Array.isArray(array) || isNill(toIndex)) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const fromIndex: number = array.indexOf(element);
|
|
183
|
+
const toIndexCorrected: number = NumberUtils.GetNearestNumberWithinBounds(toIndex, 0, array.length - 1);
|
|
184
|
+
if (fromIndex === -1 || array[toIndexCorrected] === element) {
|
|
185
|
+
// element did not exist in given array, or already existed on given toIndex
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
array.splice(toIndexCorrected, 0, array.splice(fromIndex, 1)[0]);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// PRE: elements exists in given array. POST: given elementToPlace has a lower index than given afterThisElement. Array is in-out manipulated.
|
|
193
|
+
public static PlaceElementAfterOther(array: any[], elementToPlace: any, afterThisElement: any): void {
|
|
194
|
+
if (array) {
|
|
195
|
+
const afterThisElIdx: number = array.indexOf(afterThisElement);
|
|
196
|
+
const elToPlaceIdx: number = array.indexOf(elementToPlace);
|
|
197
|
+
if (afterThisElIdx >= elToPlaceIdx) {
|
|
198
|
+
ArrayUtils.MoveElement(elementToPlace, afterThisElIdx + 1, array);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {DateUtils} from "./date-utils";
|
|
2
|
+
import {Weekday} from "../model/weekday.model";
|
|
3
|
+
import {Inject, LOCALE_ID} from "@angular/core";
|
|
4
|
+
import {LanguageCode} from "../enum/language-code.enum";
|
|
5
|
+
import {Week} from "../model/week.model";
|
|
6
|
+
|
|
7
|
+
export class CalendarUtils {
|
|
8
|
+
public static Locale: LanguageCode;
|
|
9
|
+
|
|
10
|
+
public static Now: Date = new Date();
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
@Inject(LOCALE_ID) private readonly _locale: LanguageCode
|
|
14
|
+
) {
|
|
15
|
+
CalendarUtils.Locale = _locale;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static GetCurrentYear(): number {
|
|
19
|
+
return this.Now.getFullYear();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static GetCurrentMonth(): number {
|
|
23
|
+
return this.Now.getUTCMonth() + 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static GetDayHours(day: Date): Date[] {
|
|
27
|
+
const datesByTheHour: Date[] = [];
|
|
28
|
+
if (day) {
|
|
29
|
+
let newDate: Date = new Date(day);
|
|
30
|
+
newDate.setHours(0, 0, 0, 0);
|
|
31
|
+
datesByTheHour.push(newDate);
|
|
32
|
+
for (let i: number = 0; i < 23; i++) {
|
|
33
|
+
newDate = new Date(newDate);
|
|
34
|
+
newDate.setHours(newDate.getHours() + 1);
|
|
35
|
+
datesByTheHour.push(newDate);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return datesByTheHour;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static GetDaysOfWeek(date: Date): Week {
|
|
42
|
+
let day: Date = DateUtils.GetFirstDayOfWeek(date);
|
|
43
|
+
const daysOfWeek: Weekday[] = [];
|
|
44
|
+
let options: any;
|
|
45
|
+
let month: number;
|
|
46
|
+
for (let i: number = 0; i < 7; i++) {
|
|
47
|
+
const dayPerWeek: Weekday = new Weekday();
|
|
48
|
+
const dayHours: Date[] = CalendarUtils.GetDayHours(day);
|
|
49
|
+
dayPerWeek.newMonth = day.getMonth() !== month;
|
|
50
|
+
dayPerWeek.weekdaySelected = day.getDay() === date.getDay();
|
|
51
|
+
dayPerWeek.weekdayDay = day.getDate();
|
|
52
|
+
options = { weekday: "short" };
|
|
53
|
+
dayPerWeek.weekdayShort = day.toLocaleDateString(CalendarUtils.Locale, options);
|
|
54
|
+
options = { weekday: "long" };
|
|
55
|
+
dayPerWeek.weekdayLong = day.toLocaleDateString(CalendarUtils.Locale, options);
|
|
56
|
+
|
|
57
|
+
options = { month: "short" };
|
|
58
|
+
dayPerWeek.weekdayMonthShort = day.toLocaleDateString(CalendarUtils.Locale, options);
|
|
59
|
+
options = { month: "long" };
|
|
60
|
+
dayPerWeek.weekdayMonthLong = day.toLocaleDateString(CalendarUtils.Locale, options);
|
|
61
|
+
dayPerWeek.weekdayYear = day.getFullYear();
|
|
62
|
+
|
|
63
|
+
dayPerWeek.date = new Date(day);
|
|
64
|
+
dayPerWeek.datesByTheHour = dayHours;
|
|
65
|
+
daysOfWeek.push(dayPerWeek);
|
|
66
|
+
month = day.getMonth();
|
|
67
|
+
day = new Date(day);
|
|
68
|
+
day.setDate(day.getDate() + 1);
|
|
69
|
+
}
|
|
70
|
+
const week: Week = new Week();
|
|
71
|
+
week.weekDays = daysOfWeek;
|
|
72
|
+
return week;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import {Month} from "../enum/month.enum";
|
|
2
|
+
import {ALL_MONTHS} from "../model/constant/all-months";
|
|
3
|
+
import {notNill} from "./function/not-nill.function";
|
|
4
|
+
import * as moment from "moment";
|
|
5
|
+
import {Moment} from "moment";
|
|
6
|
+
import {DatePipe} from "@angular/common";
|
|
7
|
+
import {DateRange} from "../model/date-range";
|
|
8
|
+
|
|
9
|
+
Date.prototype.toJSON = function() {
|
|
10
|
+
return moment(this).format('YYYY-MM-DD[T]HH:mm:ss');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// static utility function holder related to dates
|
|
14
|
+
export class DateUtils {
|
|
15
|
+
public static readonly BACKEND_DATE_FORMAT: string = 'YYYY-MM-DD[T]HH:mm:ss';
|
|
16
|
+
public static datePipe: DatePipe;
|
|
17
|
+
|
|
18
|
+
public static NowAsString(): string {
|
|
19
|
+
return DateUtils.ParseDate(new Date(), DateUtils.BACKEND_DATE_FORMAT);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static ParseDate(date: Date, format: string = "d-m-y"): string {
|
|
23
|
+
if (!date) {
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const day: string = ("0" + date.getDate()).slice(-2);
|
|
28
|
+
const month: string = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
29
|
+
const year: string = date.getFullYear() + "";
|
|
30
|
+
|
|
31
|
+
const formatParts: string[] = format.split("-");
|
|
32
|
+
const dateParts: string[] = [];
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
for (let i: number = 0, l: number = formatParts.length; i < l; i++) {
|
|
36
|
+
switch (formatParts[i]) {
|
|
37
|
+
case "d" :
|
|
38
|
+
case "DD" :
|
|
39
|
+
dateParts.push(day);
|
|
40
|
+
break;
|
|
41
|
+
case "m" :
|
|
42
|
+
case "MM" :
|
|
43
|
+
dateParts.push(month);
|
|
44
|
+
break;
|
|
45
|
+
case "y" :
|
|
46
|
+
case "YYYY" :
|
|
47
|
+
dateParts.push(year);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return dateParts.join("-");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static GetWeekNumber(date: Date): number {
|
|
57
|
+
date = new Date(date.getTime());
|
|
58
|
+
date.setHours(0, 0, 0, 0);
|
|
59
|
+
date.setDate(date.getDate() + 4 - (date.getDay() || 7));
|
|
60
|
+
return Math.ceil((((date.getTime() - new Date(date.getFullYear(), 0, 1).getTime()) / 8.64e7) + 1) / 7);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Returns the number of days from now, for the given date in the future. Returns negative days if given date is in the past from now.
|
|
64
|
+
public static GetDaysFromNow(date: Date): number {
|
|
65
|
+
return DateUtils.GetDayDifference(new Date(Date.now()), date);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public static StringAsDate(str: string, format: string = DateUtils.BACKEND_DATE_FORMAT): Date {
|
|
69
|
+
if (notNill(str)) {
|
|
70
|
+
if (!isNaN(Number(str))) {
|
|
71
|
+
return new Date(str);
|
|
72
|
+
} else {
|
|
73
|
+
const time: any = moment(str, format, true);
|
|
74
|
+
return time.isValid() ? new Date(time) : undefined;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public static MomentToDate(time: Moment): Date {
|
|
82
|
+
if (!time || !time.isValid()) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const d: Date = new Date(time.format(DateUtils.BACKEND_DATE_FORMAT));
|
|
87
|
+
d.setHours(time.hours());
|
|
88
|
+
d.setMinutes(time.minutes());
|
|
89
|
+
d.setSeconds(time.seconds());
|
|
90
|
+
return d;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public static GetCurrentMonth(): Month {
|
|
94
|
+
return ALL_MONTHS[new Date().getMonth()];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// @returns e.g. ["FEBRUARI", "MARCH", ..] if it's Februari today, otherwise e.g. ["APRIL", "MAY", ...] if it's April today
|
|
98
|
+
public static Get12MonthsArrayWithFirstMonthIsCurrentMonth(): Month[] {
|
|
99
|
+
const answer: Month[] = [];
|
|
100
|
+
|
|
101
|
+
let monthNrToAdd: number = new Date().getMonth();
|
|
102
|
+
for (let i: number = 0; i < 12; i++) {
|
|
103
|
+
answer.push(ALL_MONTHS[monthNrToAdd]);
|
|
104
|
+
monthNrToAdd = (monthNrToAdd + 1) % ALL_MONTHS.length;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return answer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public static GetFirstDayOfWeek(date: Date): Date {
|
|
111
|
+
if (!DateUtils._ValidDate(date)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
let firstDay: Date;
|
|
115
|
+
const dayOfWeek: number = date.getDay() || 7;
|
|
116
|
+
if (dayOfWeek === 1) {
|
|
117
|
+
firstDay = new Date(date);
|
|
118
|
+
} else {
|
|
119
|
+
firstDay = new Date(date);
|
|
120
|
+
firstDay.setHours(-24 * (dayOfWeek - 1));
|
|
121
|
+
}
|
|
122
|
+
return firstDay;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public static GetLastDayOfWeek(date: Date): Date {
|
|
126
|
+
const firstDayOfWeek: Date = DateUtils.GetFirstDayOfWeek(date);
|
|
127
|
+
const lastDayOfWeek: Date = new Date(firstDayOfWeek);
|
|
128
|
+
lastDayOfWeek.setDate(firstDayOfWeek.getDate() + 6);
|
|
129
|
+
return lastDayOfWeek;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public static GetFirstDayOfMonth(date: Date): Date {
|
|
133
|
+
if (!DateUtils._ValidDate(date)) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const year: number = date.getFullYear();
|
|
137
|
+
const month: number = date.getMonth();
|
|
138
|
+
return new Date(year, month, 1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public static GetLastDayOfMonth(date: Date): Date {
|
|
142
|
+
if (!DateUtils._ValidDate(date)) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const year: number = date.getFullYear();
|
|
146
|
+
const month: number = date.getMonth();
|
|
147
|
+
return new Date(year, month + 1, 0);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public static DatesEqual(date1: Date, date2: Date): boolean {
|
|
151
|
+
let result: boolean = false;
|
|
152
|
+
if (DateUtils._ValidDate(date1) && DateUtils._ValidDate(date2)) {
|
|
153
|
+
result =
|
|
154
|
+
date1.getDate() === date2.getDate() &&
|
|
155
|
+
date1.getMonth() === date2.getMonth() &&
|
|
156
|
+
date1.getFullYear() === date2.getFullYear();
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public static DateRangeEqual(dates1: DateRange, dates2: DateRange): boolean {
|
|
162
|
+
return (this.DatesEqual(dates1.startDate, dates2.startDate) &&
|
|
163
|
+
this.DatesEqual(dates1.endDate, dates2.endDate));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public static AddMinutes(date: Date, minutes: number): Date {
|
|
167
|
+
return new Date(date.getTime() + (minutes * 60000));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public static AddDays(date: Date, days: number): Date {
|
|
171
|
+
const result: Date = new Date(date);
|
|
172
|
+
result.setDate(result.getDate() + days);
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public static AddMonths(date: Date, months: number): Date {
|
|
177
|
+
const result: Date = new Date(date);
|
|
178
|
+
result.setMonth(result.getMonth() + months);
|
|
179
|
+
return result;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public static DetermineDSTBreakpoints(): { start: string, end: string } {
|
|
183
|
+
const endOfYear: Date = new Date(new Date().getFullYear(), 11, 1);
|
|
184
|
+
let checkDate: Date = new Date(new Date().getFullYear(), 0, 1);
|
|
185
|
+
let offset: number = checkDate.getTimezoneOffset();
|
|
186
|
+
|
|
187
|
+
const periodStart: Date = new Date();
|
|
188
|
+
let periodStartSet: boolean = false;
|
|
189
|
+
const periodEnd: Date = new Date();
|
|
190
|
+
let periodEndSet: boolean = false;
|
|
191
|
+
while (checkDate.getTime() < endOfYear.getTime()) {
|
|
192
|
+
checkDate = this.AddMinutes(checkDate, 60);
|
|
193
|
+
if (offset < checkDate.getTimezoneOffset()) {
|
|
194
|
+
periodEnd.setTime(checkDate.getTime());
|
|
195
|
+
periodEndSet = true;
|
|
196
|
+
} else if (offset > checkDate.getTimezoneOffset()) {
|
|
197
|
+
periodStart.setTime(checkDate.getTime());
|
|
198
|
+
periodStartSet = true;
|
|
199
|
+
}
|
|
200
|
+
offset = checkDate.getTimezoneOffset();
|
|
201
|
+
if (periodStartSet && periodEndSet) {
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (periodStartSet && periodEndSet) {
|
|
207
|
+
return {
|
|
208
|
+
start: this._DateToTimeStringWithDateFormat(periodStart),
|
|
209
|
+
end: this._DateToTimeStringWithDateFormat(periodEnd)
|
|
210
|
+
};
|
|
211
|
+
} else {
|
|
212
|
+
return {start: undefined, end: undefined}; // important otherwise we return new Date() for both
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private static _ValidDate(date: Date): boolean {
|
|
217
|
+
return date !== null && date !== undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Returns the difference between the two given days as the number of days, in float precision (date to - date from).
|
|
222
|
+
* Returns negative values of the 'from' date is later than in time than the 'to' date.
|
|
223
|
+
*/
|
|
224
|
+
public static GetDayDifference(from: Date, to: Date): number {
|
|
225
|
+
if (!from || !to) {
|
|
226
|
+
return NaN;
|
|
227
|
+
}
|
|
228
|
+
return ((to.getTime() - from.getTime()) / 1000 / 60 / 60 / 24);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public static IsSameDay(dateOne: Date, dateTwo: Date): boolean {
|
|
232
|
+
return (dateOne && dateTwo &&
|
|
233
|
+
dateOne.getDate() === dateTwo.getDate()
|
|
234
|
+
&& dateOne.getMonth() === dateTwo.getMonth()
|
|
235
|
+
&& dateOne.getFullYear() === dateTwo.getFullYear());
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
public static IsInBetween(date: Date, startDate: Date, endDate: Date, withTime: boolean = true): boolean {
|
|
239
|
+
if (startDate && endDate) {
|
|
240
|
+
if (withTime) {
|
|
241
|
+
return (date > startDate && date < endDate);
|
|
242
|
+
} else {
|
|
243
|
+
const dateWithoutTime: number = new Date(date).setHours(0, 0, 0, 0),
|
|
244
|
+
dateFromWithoutTime: number = new Date(startDate).setHours(0, 0, 0, 0),
|
|
245
|
+
dateToWithoutTime: number = new Date(endDate).setHours(0, 0, 0, 0);
|
|
246
|
+
return dateWithoutTime >= dateFromWithoutTime && dateWithoutTime <= dateToWithoutTime;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
public static IsMonday(date: Date): boolean {
|
|
252
|
+
return date.getDay() === 1;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
public static IsSunday(date: Date): boolean {
|
|
256
|
+
return date.getDay() === 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
public static IsToday(date: Date): boolean {
|
|
260
|
+
const today: Date = new Date();
|
|
261
|
+
return DateUtils.IsSameDay(today, date);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Returns date format like it would when using a pipe in the templete, ie: "1 okt. 2020"
|
|
265
|
+
public static ParseDateInShortDateFormat(date: Date, locale: string): string {
|
|
266
|
+
this.datePipe = new DatePipe(locale);
|
|
267
|
+
const parsedDate: string = this.datePipe.transform(date);
|
|
268
|
+
return parsedDate;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Transforms a string that is formatted like "'17-08-2014'<=?<='17-08-2021'" into "'17-08-2014' Untill '17-08-2021'"
|
|
272
|
+
public static getFormattedDateRangeString(dateRangeString: string, separator: string = " - "): string {
|
|
273
|
+
let newString: string = dateRangeString;
|
|
274
|
+
newString = newString.replace("<=?<=", ` ${separator} `);
|
|
275
|
+
newString = newString.replace(/'/g, "");
|
|
276
|
+
|
|
277
|
+
return newString;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public static SetDateOrDateRangeObjectHoursZero(date: Date | DateRange): void {
|
|
281
|
+
if (date instanceof DateRange) {
|
|
282
|
+
if (date.startDate) {
|
|
283
|
+
date.startDate.setHours(0, 0, 0);
|
|
284
|
+
}
|
|
285
|
+
if (date.endDate) {
|
|
286
|
+
date.endDate.setHours(0, 0, 0);
|
|
287
|
+
}
|
|
288
|
+
} else if (!!date && (date instanceof Date)) {
|
|
289
|
+
date.setHours(0, 0, 0, 0);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
private static _DateToTimeStringWithDateFormat(value: Date, dateFormat: string = "d-m-y"): string {
|
|
294
|
+
if (!value) {
|
|
295
|
+
return "";
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const hours: string = value.getHours() < 10 ? "0" + value.getHours() : "" + value.getHours();
|
|
299
|
+
const minutes: string = value.getMinutes() < 10 ? "0" + value.getMinutes() : "" + value.getMinutes();
|
|
300
|
+
return this.ParseDate(value, dateFormat) + " " + [hours, minutes].join(":");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Static utility functions holder related to strings.
|
|
2
|
+
export class StringUtils {
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns a new string where given placeholder in given source string are replaced by given replacement texts.
|
|
6
|
+
*
|
|
7
|
+
* Example usage:
|
|
8
|
+
*
|
|
9
|
+
* source = "ABCDABCD"
|
|
10
|
+
* placeholder = "BC"
|
|
11
|
+
* replacementTexts = "Z", "Z" (REST arguments)
|
|
12
|
+
* OUTPUT = "AZDAZD"
|
|
13
|
+
*
|
|
14
|
+
* @param {string} source
|
|
15
|
+
* @param {string} placeholder
|
|
16
|
+
* @param {string} replacementTexts If only one is given, this function replaces all placeholders with that single replacementText.
|
|
17
|
+
* If more are given, placeholders without a corresponding replacementText will remain their original placeholder characters.
|
|
18
|
+
*/
|
|
19
|
+
public static ReplaceOccurrencesIn(source: string, placeholder: string, ...replacementTexts: string[]): string {
|
|
20
|
+
// parameter guards
|
|
21
|
+
if (!(source)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (!placeholder || replacementTexts.length === 0) {
|
|
25
|
+
return source;
|
|
26
|
+
}
|
|
27
|
+
let outString: string = source;
|
|
28
|
+
// one replacementText means replace for all
|
|
29
|
+
if (replacementTexts.length === 1) {
|
|
30
|
+
// "g" is the g flag to replace globally
|
|
31
|
+
outString = outString.replace(placeholder, replacementTexts[0]);
|
|
32
|
+
} else {
|
|
33
|
+
// replace occurence i by replacementTexts[i], one at a time in loop (there might be a faster way..)
|
|
34
|
+
for (let i: number = 0, len: number = replacementTexts.length; i < len; i++) {
|
|
35
|
+
outString = outString.replace(placeholder, replacementTexts[i]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return outString;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Returns the given argument as a string. Returns given defaultValue if conversion of argument to string was impossible.
|
|
42
|
+
public static ParseString(arg: any, defaultValue: string = ""): string {
|
|
43
|
+
if (!StringUtils.IsString(arg)) {
|
|
44
|
+
if (arg && typeof arg.toString === "function") {
|
|
45
|
+
arg = arg.toString();
|
|
46
|
+
} else {
|
|
47
|
+
arg = defaultValue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return arg;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static IsString(str: any): boolean {
|
|
54
|
+
return typeof str === 'string';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Returns whether given str is a string and has a length > 0.
|
|
58
|
+
public static IsStringWithLength(str: string): boolean {
|
|
59
|
+
return str && StringUtils.IsString(str) && str.length > 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Returns given string, escaped for use as string literal in regular expressions.
|
|
63
|
+
private static _escapeRegExp(str: string): string {
|
|
64
|
+
return str;// .replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^$\|]/g, "\\$&");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of sharedcomponents
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
export * from './lib/components/docsign/docsign.component';
|
|
2
6
|
export * from './lib/components/docsign/docsign.module';
|
|
3
7
|
export * from './lib/components/stock/stock.component';
|
|
@@ -15,3 +19,4 @@ export * from './lib/components/linear-gauge/co-linear-gauge.module';
|
|
|
15
19
|
export * from './lib/components/statusbar/statusbar.component';
|
|
16
20
|
export * from './lib/components/statusbar/statusbar.module';
|
|
17
21
|
export * from './lib/service/shared.service';
|
|
22
|
+
|