wj-elements 0.2.0-alpha.5 → 0.2.0-alpha.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.
- package/dist/wje-file-upload.js +1 -0
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-select.js +76 -32
- package/dist/wje-select.js.map +1 -1
- package/package.json +1 -1
- package/dist/packages/index.d.ts +0 -107
- package/dist/packages/internals/form-associated-element.d.ts +0 -143
- package/dist/packages/localize/localize.d.ts +0 -48
- package/dist/packages/translations/en-gb.d.ts +0 -18
- package/dist/packages/translations/sk-sk.d.ts +0 -13
- package/dist/packages/utils/animations.d.ts +0 -2
- package/dist/packages/utils/base-path.d.ts +0 -14
- package/dist/packages/utils/date.d.ts +0 -2
- package/dist/packages/utils/element-utils.d.ts +0 -46
- package/dist/packages/utils/event.d.ts +0 -67
- package/dist/packages/utils/icon-library.d.ts +0 -3
- package/dist/packages/utils/localize.d.ts +0 -4
- package/dist/packages/utils/permissions.d.ts +0 -40
- package/dist/packages/utils/universal-service.d.ts +0 -18
- package/dist/packages/utils/utils.d.ts +0 -1
- package/dist/packages/wje-accordion/accordion.d.ts +0 -2
- package/dist/packages/wje-accordion/accordion.element.d.ts +0 -72
- package/dist/packages/wje-accordion/accordion.test.d.ts +0 -0
- package/dist/packages/wje-accordion-item/accordion-item.d.ts +0 -2
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +0 -40
- package/dist/packages/wje-animation/animation.d.ts +0 -2
- package/dist/packages/wje-animation/animation.element.d.ts +0 -158
- package/dist/packages/wje-animation/animation.test.d.ts +0 -1
- package/dist/packages/wje-aside/aside.d.ts +0 -2
- package/dist/packages/wje-aside/aside.element.d.ts +0 -31
- package/dist/packages/wje-avatar/avatar.d.ts +0 -2
- package/dist/packages/wje-avatar/avatar.element.d.ts +0 -76
- package/dist/packages/wje-avatar/avatar.test.d.ts +0 -1
- package/dist/packages/wje-avatar/service/service.d.ts +0 -52
- package/dist/packages/wje-badge/badge.d.ts +0 -2
- package/dist/packages/wje-badge/badge.element.d.ts +0 -35
- package/dist/packages/wje-badge/badge.test.d.ts +0 -1
- package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +0 -2
- package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +0 -98
- package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +0 -2
- package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +0 -105
- package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +0 -1
- package/dist/packages/wje-button/button.d.ts +0 -2
- package/dist/packages/wje-button/button.element.d.ts +0 -204
- package/dist/packages/wje-button/button.test.d.ts +0 -1
- package/dist/packages/wje-button-group/button-group.d.ts +0 -2
- package/dist/packages/wje-button-group/button-group.element.d.ts +0 -96
- package/dist/packages/wje-card/card.d.ts +0 -2
- package/dist/packages/wje-card/card.element.d.ts +0 -31
- package/dist/packages/wje-card-content/card-content.d.ts +0 -2
- package/dist/packages/wje-card-content/card-content.element.d.ts +0 -22
- package/dist/packages/wje-card-controls/card-controls.d.ts +0 -2
- package/dist/packages/wje-card-controls/card-controls.element.d.ts +0 -23
- package/dist/packages/wje-card-header/card-header.d.ts +0 -2
- package/dist/packages/wje-card-header/card-header.element.d.ts +0 -22
- package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +0 -2
- package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +0 -30
- package/dist/packages/wje-card-title/card-title.d.ts +0 -2
- package/dist/packages/wje-card-title/card-title.element.d.ts +0 -32
- package/dist/packages/wje-carousel/carousel.d.ts +0 -2
- package/dist/packages/wje-carousel/carousel.element.d.ts +0 -154
- package/dist/packages/wje-carousel-item/carousel-item.d.ts +0 -2
- package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +0 -38
- package/dist/packages/wje-checkbox/checkbox.d.ts +0 -2
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +0 -100
- package/dist/packages/wje-chip/chip.d.ts +0 -2
- package/dist/packages/wje-chip/chip.element.d.ts +0 -76
- package/dist/packages/wje-chip/chip.test.d.ts +0 -1
- package/dist/packages/wje-col/col.d.ts +0 -2
- package/dist/packages/wje-col/col.element.d.ts +0 -16
- package/dist/packages/wje-color-picker/color-picker.d.ts +0 -2
- package/dist/packages/wje-color-picker/color-picker.element.d.ts +0 -230
- package/dist/packages/wje-color-picker/color-picker.test.d.ts +0 -1
- package/dist/packages/wje-container/container.d.ts +0 -2
- package/dist/packages/wje-container/container.element.d.ts +0 -31
- package/dist/packages/wje-copy-button/copy-button.d.ts +0 -2
- package/dist/packages/wje-copy-button/copy-button.element.d.ts +0 -89
- package/dist/packages/wje-copy-button/service/service.d.ts +0 -12
- package/dist/packages/wje-dialog/dialog.d.ts +0 -2
- package/dist/packages/wje-dialog/dialog.element.d.ts +0 -132
- package/dist/packages/wje-divider/divider.d.ts +0 -2
- package/dist/packages/wje-divider/divider.element.d.ts +0 -32
- package/dist/packages/wje-dropdown/dropdown.d.ts +0 -2
- package/dist/packages/wje-dropdown/dropdown.element.d.ts +0 -108
- package/dist/packages/wje-element/element.d.ts +0 -341
- package/dist/packages/wje-file-upload/file-upload.d.ts +0 -2
- package/dist/packages/wje-file-upload/file-upload.element.d.ts +0 -203
- package/dist/packages/wje-file-upload/file-upload.test.d.ts +0 -1
- package/dist/packages/wje-file-upload/service/service.d.ts +0 -70
- package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +0 -2
- package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +0 -84
- package/dist/packages/wje-footer/footer.d.ts +0 -2
- package/dist/packages/wje-footer/footer.element.d.ts +0 -28
- package/dist/packages/wje-form/form.d.ts +0 -2
- package/dist/packages/wje-form/form.element.d.ts +0 -28
- package/dist/packages/wje-format-digital/format-digital.d.ts +0 -2
- package/dist/packages/wje-format-digital/format-digital.element.d.ts +0 -83
- package/dist/packages/wje-format-digital/format-digital.test.d.ts +0 -1
- package/dist/packages/wje-grid/grid.d.ts +0 -2
- package/dist/packages/wje-grid/grid.element.d.ts +0 -26
- package/dist/packages/wje-header/header.d.ts +0 -2
- package/dist/packages/wje-header/header.element.d.ts +0 -35
- package/dist/packages/wje-icon/icon.d.ts +0 -2
- package/dist/packages/wje-icon/icon.element.d.ts +0 -40
- package/dist/packages/wje-icon/service/library.d.ts +0 -3
- package/dist/packages/wje-icon/service/service.d.ts +0 -11
- package/dist/packages/wje-icon-picker/icon-picker.d.ts +0 -2
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +0 -210
- package/dist/packages/wje-img/img.d.ts +0 -2
- package/dist/packages/wje-img/img.element.d.ts +0 -118
- package/dist/packages/wje-img-comparer/img-comparer.d.ts +0 -2
- package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +0 -60
- package/dist/packages/wje-img-comparer/service/service.d.ts +0 -1
- package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +0 -2
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +0 -173
- package/dist/packages/wje-input/input.d.ts +0 -2
- package/dist/packages/wje-input/input.element.d.ts +0 -159
- package/dist/packages/wje-input-file/input-file.d.ts +0 -2
- package/dist/packages/wje-input-file/input-file.element.d.ts +0 -50
- package/dist/packages/wje-item/item.d.ts +0 -2
- package/dist/packages/wje-item/item.element.d.ts +0 -68
- package/dist/packages/wje-kanban/kanban.d.ts +0 -2
- package/dist/packages/wje-kanban/kanban.element.d.ts +0 -182
- package/dist/packages/wje-label/label.d.ts +0 -2
- package/dist/packages/wje-label/label.element.d.ts +0 -34
- package/dist/packages/wje-level-indicator/level-indicator.d.ts +0 -2
- package/dist/packages/wje-level-indicator/level-indicator.element.d.ts +0 -91
- package/dist/packages/wje-list/list.d.ts +0 -2
- package/dist/packages/wje-list/list.element.d.ts +0 -31
- package/dist/packages/wje-main/main.d.ts +0 -2
- package/dist/packages/wje-main/main.element.d.ts +0 -30
- package/dist/packages/wje-masonry/masonry.d.ts +0 -2
- package/dist/packages/wje-masonry/masonry.element.d.ts +0 -114
- package/dist/packages/wje-masonry/service/service.d.ts +0 -32
- package/dist/packages/wje-menu/menu.d.ts +0 -2
- package/dist/packages/wje-menu/menu.element.d.ts +0 -47
- package/dist/packages/wje-menu-button/menu-button.d.ts +0 -2
- package/dist/packages/wje-menu-button/menu-button.element.d.ts +0 -34
- package/dist/packages/wje-menu-item/menu-item.d.ts +0 -2
- package/dist/packages/wje-menu-item/menu-item.element.d.ts +0 -161
- package/dist/packages/wje-menu-label/menu-label.d.ts +0 -2
- package/dist/packages/wje-menu-label/menu-label.element.d.ts +0 -39
- package/dist/packages/wje-option/option.d.ts +0 -2
- package/dist/packages/wje-option/option.element.d.ts +0 -95
- package/dist/packages/wje-options/options.d.ts +0 -2
- package/dist/packages/wje-options/options.element.d.ts +0 -232
- package/dist/packages/wje-orgchart/orgchart.d.ts +0 -2
- package/dist/packages/wje-orgchart/orgchart.element.d.ts +0 -24
- package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +0 -2
- package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +0 -28
- package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +0 -2
- package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +0 -49
- package/dist/packages/wje-pagination/pagination.d.ts +0 -2
- package/dist/packages/wje-pagination/pagination.element.d.ts +0 -178
- package/dist/packages/wje-pagination/pagination.test.d.ts +0 -1
- package/dist/packages/wje-pagination/service/service.d.ts +0 -9
- package/dist/packages/wje-panel/panel.d.ts +0 -2
- package/dist/packages/wje-panel/panel.element.d.ts +0 -34
- package/dist/packages/wje-popup/popup.d.ts +0 -2
- package/dist/packages/wje-popup/popup.element.d.ts +0 -145
- package/dist/packages/wje-progress-bar/progress-bar.d.ts +0 -2
- package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +0 -96
- package/dist/packages/wje-qr-code/qr-code.d.ts +0 -2
- package/dist/packages/wje-qr-code/qr-code.element.d.ts +0 -33
- package/dist/packages/wje-radio/radio.d.ts +0 -2
- package/dist/packages/wje-radio/radio.element.d.ts +0 -64
- package/dist/packages/wje-radio-group/radio-group.d.ts +0 -2
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +0 -61
- package/dist/packages/wje-rate/rate.d.ts +0 -2
- package/dist/packages/wje-rate/rate.element.d.ts +0 -156
- package/dist/packages/wje-relative-time/relative-time.d.ts +0 -2
- package/dist/packages/wje-relative-time/relative-time.element.d.ts +0 -55
- package/dist/packages/wje-relative-time/relative-time.test.d.ts +0 -1
- package/dist/packages/wje-reorder/reorder.d.ts +0 -2
- package/dist/packages/wje-reorder/reorder.element.d.ts +0 -119
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +0 -2
- package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +0 -23
- package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +0 -2
- package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +0 -84
- package/dist/packages/wje-reorder-item/reorder-item.d.ts +0 -2
- package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +0 -24
- package/dist/packages/wje-route/route.d.ts +0 -2
- package/dist/packages/wje-route/route.element.d.ts +0 -22
- package/dist/packages/wje-router/router.d.ts +0 -2
- package/dist/packages/wje-router/router.element.d.ts +0 -43
- package/dist/packages/wje-router-link/router-link.d.ts +0 -2
- package/dist/packages/wje-router-link/router-link.element.d.ts +0 -31
- package/dist/packages/wje-router-outlet/router-outlet.d.ts +0 -2
- package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +0 -16
- package/dist/packages/wje-row/row.d.ts +0 -2
- package/dist/packages/wje-row/row.element.d.ts +0 -23
- package/dist/packages/wje-select/select.d.ts +0 -2
- package/dist/packages/wje-select/select.element.d.ts +0 -386
- package/dist/packages/wje-select/select.test.d.ts +0 -1
- package/dist/packages/wje-slider/slider.d.ts +0 -2
- package/dist/packages/wje-slider/slider.element.d.ts +0 -103
- package/dist/packages/wje-sliding-container/sliding-container.d.ts +0 -2
- package/dist/packages/wje-sliding-container/sliding-container.element.d.ts +0 -265
- package/dist/packages/wje-split-view/service/service.d.ts +0 -1
- package/dist/packages/wje-split-view/split-view.d.ts +0 -2
- package/dist/packages/wje-split-view/split-view.element.d.ts +0 -65
- package/dist/packages/wje-status/status.d.ts +0 -2
- package/dist/packages/wje-status/status.element.d.ts +0 -26
- package/dist/packages/wje-step/step.d.ts +0 -2
- package/dist/packages/wje-step/step.element.d.ts +0 -23
- package/dist/packages/wje-stepper/stepper.d.ts +0 -2
- package/dist/packages/wje-stepper/stepper.element.d.ts +0 -125
- package/dist/packages/wje-store/default-store-actions.d.ts +0 -25
- package/dist/packages/wje-store/pubsub.d.ts +0 -22
- package/dist/packages/wje-store/store.d.ts +0 -153
- package/dist/packages/wje-tab/tab.d.ts +0 -2
- package/dist/packages/wje-tab/tab.element.d.ts +0 -66
- package/dist/packages/wje-tab-group/tab-group.d.ts +0 -2
- package/dist/packages/wje-tab-group/tab-group.element.d.ts +0 -131
- package/dist/packages/wje-tab-group/tab-group.test.d.ts +0 -1
- package/dist/packages/wje-tab-panel/tab-panel.d.ts +0 -2
- package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +0 -23
- package/dist/packages/wje-textarea/textarea.d.ts +0 -2
- package/dist/packages/wje-textarea/textarea.element.d.ts +0 -89
- package/dist/packages/wje-thumbnail/thumbnail.d.ts +0 -2
- package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +0 -31
- package/dist/packages/wje-timeline/timeline.d.ts +0 -2
- package/dist/packages/wje-timeline/timeline.element.d.ts +0 -25
- package/dist/packages/wje-timeline-item/timeline-item.d.ts +0 -2
- package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +0 -27
- package/dist/packages/wje-toast/toast.d.ts +0 -2
- package/dist/packages/wje-toast/toast.element.d.ts +0 -173
- package/dist/packages/wje-toast/toast.test.d.ts +0 -1
- package/dist/packages/wje-toggle/toggle.d.ts +0 -2
- package/dist/packages/wje-toggle/toggle.element.d.ts +0 -81
- package/dist/packages/wje-toggle/toggle.test.d.ts +0 -1
- package/dist/packages/wje-toolbar/toolbar.d.ts +0 -2
- package/dist/packages/wje-toolbar/toolbar.element.d.ts +0 -39
- package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +0 -2
- package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +0 -35
- package/dist/packages/wje-tooltip/tooltip.d.ts +0 -2
- package/dist/packages/wje-tooltip/tooltip.element.d.ts +0 -77
- package/dist/packages/wje-tree/tree.d.ts +0 -2
- package/dist/packages/wje-tree/tree.element.d.ts +0 -105
- package/dist/packages/wje-tree/tree.test.d.ts +0 -1
- package/dist/packages/wje-tree-item/tree-item.d.ts +0 -2
- package/dist/packages/wje-tree-item/tree-item.element.d.ts +0 -155
- package/dist/packages/wje-tree-item/tree-item.test.d.ts +0 -1
- package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +0 -2
- package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +0 -29
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { UniversalService } from '../utils/universal-service.js';
|
|
2
|
-
import { defaultStoreActions } from '../wje-store/store.js';
|
|
3
|
-
import { Permissions } from '../utils/permissions.js';
|
|
4
|
-
import { WjElementUtils } from '../utils/element-utils.js';
|
|
5
|
-
import { event } from '../utils/event.js';
|
|
6
|
-
export default class WJElement extends HTMLElement {
|
|
7
|
-
/**
|
|
8
|
-
* Processes and combines two templates into one.
|
|
9
|
-
* @param pTemplate The primary template.
|
|
10
|
-
* @param inputTemplate The secondary template.
|
|
11
|
-
* @returns The combined template.
|
|
12
|
-
*/
|
|
13
|
-
static processTemplates: (pTemplate: any, inputTemplate: any) => HTMLTemplateElement;
|
|
14
|
-
/**
|
|
15
|
-
* Defines a custom element if not already defined.
|
|
16
|
-
* @param name The name of the custom element.
|
|
17
|
-
* @param [elementConstructor] The constructor for the custom element.
|
|
18
|
-
* @param [options] Additional options for defining the element.
|
|
19
|
-
*/
|
|
20
|
-
static define(name: any, elementConstructor?: typeof WJElement, options?: {}): void;
|
|
21
|
-
service: UniversalService;
|
|
22
|
-
_dependencies: {};
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {object} DrawingStatuses
|
|
25
|
-
* @property {number} CREATED - The component has been created.
|
|
26
|
-
* @property {number} ATTACHED - The component has been attached to the DOM.
|
|
27
|
-
* @property {number} BEGINING - The component is beginning to draw.
|
|
28
|
-
* @property {number} START - The component has started drawing.
|
|
29
|
-
* @property {number} DRAWING - The component is drawing.
|
|
30
|
-
* @property {number} DONE - The component has finished drawing.
|
|
31
|
-
* @property {number} DISCONNECTED - The component has been disconnected from the DOM.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* WJElement is a base class for custom web components with managed lifecycle, attribute/property sync,
|
|
35
|
-
* permission-based visibility, and extensibility hooks.
|
|
36
|
-
* @property {boolean} isAttached - True if the component is currently attached to the DOM.
|
|
37
|
-
* @property {DrawingStatuses} drawingStatuses - Enum of possible drawing states.
|
|
38
|
-
* @property {number} drawingStatus - Current drawing status (see drawingStatuses).
|
|
39
|
-
* @property {boolean} _pristine - True if the component has not been updated since last render.
|
|
40
|
-
* @property {boolean} isRendering - True if a render is currently in progress.
|
|
41
|
-
* @property {number|null} rafId - ID of the scheduled animation frame for rendering, or null.
|
|
42
|
-
* @property {string|null} originalVisibility - Stores the original CSS visibility before rendering.
|
|
43
|
-
* @property {object} params - Stores the current attributes/properties for rendering.
|
|
44
|
-
* @property {Promise<void>} updateComplete - Promise resolved when the current update/render is complete.
|
|
45
|
-
* @property {string[]} permission - List of required permissions (from 'permission' attribute).
|
|
46
|
-
* @property {boolean} isPermissionCheck - Whether permission checking is enabled (from 'permission-check' attribute).
|
|
47
|
-
* @property {boolean} noShow - Whether the element should be hidden (from 'no-show' attribute).
|
|
48
|
-
* @property {string|undefined} isShadowRoot - Value of the 'shadow' attribute, if present.
|
|
49
|
-
* @property {boolean} hasShadowRoot - True if the 'shadow' attribute is present.
|
|
50
|
-
* @property {string} shadowType - Type of shadow root ('open' by default).
|
|
51
|
-
* @property {object} store - Reference to the global store instance.
|
|
52
|
-
* @property {object} defaultStoreActions - Default store actions for arrays and objects.
|
|
53
|
-
* @property {string[]|undefined} removeClassAfterConnect - Classes to remove after connect (from 'remove-class-after-connect' attribute).
|
|
54
|
-
* @property {object} dependencies - Registered component dependencies.
|
|
55
|
-
* @property {HTMLElement|ShadowRoot} context - The rendering context (shadow root or element itself).
|
|
56
|
-
*/
|
|
57
|
-
drawingStatuses: {
|
|
58
|
-
CREATED: number;
|
|
59
|
-
ATTACHED: number;
|
|
60
|
-
BEGINING: number;
|
|
61
|
-
START: number;
|
|
62
|
-
DRAWING: number;
|
|
63
|
-
DONE: number;
|
|
64
|
-
DISCONNECTED: number;
|
|
65
|
-
};
|
|
66
|
-
rafId: number;
|
|
67
|
-
params: {};
|
|
68
|
-
updateComplete: Promise<any>;
|
|
69
|
-
finisPromise: (value: any) => void;
|
|
70
|
-
rejectPromise: (reason?: any) => void;
|
|
71
|
-
get drawingStatus(): number;
|
|
72
|
-
/**
|
|
73
|
-
* Sets the value of the 'permission' attribute.
|
|
74
|
-
* @param {string[]} value The value to set for the 'permission' attribute.
|
|
75
|
-
*/
|
|
76
|
-
set permission(value: string[]);
|
|
77
|
-
/**
|
|
78
|
-
* Gets the value of the 'permission-check' attribute.
|
|
79
|
-
* @returns {string[]} The value of the 'permission' attribute.
|
|
80
|
-
*/
|
|
81
|
-
get permission(): string[];
|
|
82
|
-
/**
|
|
83
|
-
* Sets the 'permission-check' attribute.
|
|
84
|
-
* @param {boolean} value The value to set for the 'permission-check' attribute.
|
|
85
|
-
*/
|
|
86
|
-
set isPermissionCheck(value: boolean);
|
|
87
|
-
/**
|
|
88
|
-
* Checks if the 'permission-check' attribute is present.
|
|
89
|
-
* @returns {boolean} True if the 'permission-check' attribute is present.
|
|
90
|
-
*/
|
|
91
|
-
get isPermissionCheck(): boolean;
|
|
92
|
-
set noShow(value: boolean);
|
|
93
|
-
/**
|
|
94
|
-
* Checks if the 'show' attribute is present.
|
|
95
|
-
* @returns {boolean} True if the 'show' attribute is present.
|
|
96
|
-
*/
|
|
97
|
-
get noShow(): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Sets the 'shadow' attribute.
|
|
100
|
-
* @param {string} value The value to set for the 'shadow' attribute.
|
|
101
|
-
*/
|
|
102
|
-
set isShadowRoot(value: string);
|
|
103
|
-
get isShadowRoot(): string;
|
|
104
|
-
/**
|
|
105
|
-
* Checks if the 'shadow' attribute is present.
|
|
106
|
-
* @returns {boolean} True if the 'shadow' attribute is present.
|
|
107
|
-
*/
|
|
108
|
-
get hasShadowRoot(): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Gets the value of the 'shadow' attribute or 'open' if not set.
|
|
111
|
-
* @returns {string} The value of the 'shadow' attribute or 'open'.
|
|
112
|
-
*/
|
|
113
|
-
get shadowType(): string;
|
|
114
|
-
/**
|
|
115
|
-
* Gets the rendering context, either the shadow root or the component itself.
|
|
116
|
-
* @returns The rendering context.
|
|
117
|
-
*/
|
|
118
|
-
get context(): any;
|
|
119
|
-
/**
|
|
120
|
-
* Gets the store instance.
|
|
121
|
-
* @returns {object} The store instance.
|
|
122
|
-
*/
|
|
123
|
-
get store(): object;
|
|
124
|
-
/**
|
|
125
|
-
* @typedef {object} ArrayActions
|
|
126
|
-
* @property {Function} addAction - Adds an item to the array.
|
|
127
|
-
* @property {Function} deleteAction - Deletes an item from the array.
|
|
128
|
-
* @property {Function} loadAction - Loads an array.
|
|
129
|
-
* @property {Function} updateAction - Updates an item in the array.
|
|
130
|
-
* @property {Function} addManyAction - Adds many items to the array.
|
|
131
|
-
*/
|
|
132
|
-
/**
|
|
133
|
-
* @typedef {object} ObjectActions
|
|
134
|
-
* @property {Function} addAction - Replace old object with new object
|
|
135
|
-
* @property {Function} deleteAction - Delete item based on key
|
|
136
|
-
* @property {Function} updateAction - Update item based on key
|
|
137
|
-
*/
|
|
138
|
-
/**
|
|
139
|
-
* Gets the default store actions.
|
|
140
|
-
* @returns The default store actions for arrays and objects.
|
|
141
|
-
*/
|
|
142
|
-
get defaultStoreActions(): typeof defaultStoreActions;
|
|
143
|
-
/**
|
|
144
|
-
* Gets the classes to be removed after the component is connected.
|
|
145
|
-
* @returns An array of class names to remove.
|
|
146
|
-
*/
|
|
147
|
-
get removeClassAfterConnect(): string[];
|
|
148
|
-
/**
|
|
149
|
-
* Sets the component dependencies.
|
|
150
|
-
* @param value The dependencies to set.
|
|
151
|
-
*/
|
|
152
|
-
set dependencies(value: {});
|
|
153
|
-
/**
|
|
154
|
-
* Gets the component dependencies.
|
|
155
|
-
* @returns The component dependencies.
|
|
156
|
-
*/
|
|
157
|
-
get dependencies(): {};
|
|
158
|
-
/**
|
|
159
|
-
* Defines component dependencies by registering custom elements.
|
|
160
|
-
*/
|
|
161
|
-
defineDependencies(): void;
|
|
162
|
-
/**
|
|
163
|
-
* Hook for extending behavior before drawing the component.
|
|
164
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
165
|
-
* @param appStoreObj The global application store for managing state.
|
|
166
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
167
|
-
*/
|
|
168
|
-
beforeDraw(context: any, appStoreObj: any, params: any): void;
|
|
169
|
-
/**
|
|
170
|
-
* Renders the component within the provided context.
|
|
171
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
172
|
-
* @param appStoreObj
|
|
173
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
174
|
-
* @returns This implementation does not render anything and returns `null`.
|
|
175
|
-
* @description
|
|
176
|
-
* The `draw` method is responsible for rendering the component's content.
|
|
177
|
-
* Override this method in subclasses to define custom rendering logic.
|
|
178
|
-
* @example
|
|
179
|
-
* class MyComponent extends WJElement {
|
|
180
|
-
* draw(context, appStoreObj, params) {
|
|
181
|
-
* const div = document.createElement('div');
|
|
182
|
-
* div.textContent = 'Hello, world!';
|
|
183
|
-
* context.appendChild(div);
|
|
184
|
-
* }
|
|
185
|
-
* }
|
|
186
|
-
*/
|
|
187
|
-
draw(context: any, appStoreObj: any, params: any): any;
|
|
188
|
-
/**
|
|
189
|
-
* Renders the component within the provided context.
|
|
190
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
191
|
-
* @param appStore The global application store for managing state.
|
|
192
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
193
|
-
* @returns This implementation does not render anything and returns `null`.
|
|
194
|
-
* @description
|
|
195
|
-
* The `draw` method is responsible for rendering the component's content.
|
|
196
|
-
* Override this method in subclasses to define custom rendering logic.
|
|
197
|
-
* @example
|
|
198
|
-
* class MyComponent extends WJElement {
|
|
199
|
-
* draw(context, appStore, params) {
|
|
200
|
-
* const div = document.createElement('div');
|
|
201
|
-
* div.textContent = 'Hello, world!';
|
|
202
|
-
* context.appendChild(div);
|
|
203
|
-
* }
|
|
204
|
-
* }
|
|
205
|
-
*/
|
|
206
|
-
draw(context: any, appStore: any, params: any): any;
|
|
207
|
-
/**
|
|
208
|
-
* Hook for extending behavior after drawing the component.
|
|
209
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
210
|
-
* @param appStoreObj The global application store for managing state.
|
|
211
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
212
|
-
*/
|
|
213
|
-
afterDraw(context: any, appStoreObj: any, params: any): void;
|
|
214
|
-
/**
|
|
215
|
-
* Optional hook: return skeleton markup used while async draw is in progress.
|
|
216
|
-
* Prefer declarative skeleton via `<div slot="skeleton">...</div>`.
|
|
217
|
-
* Return: string | Node | DocumentFragment | null | Promise of those.
|
|
218
|
-
*/
|
|
219
|
-
renderSkeleton(params: any): any;
|
|
220
|
-
set skeletonDelay(value: number);
|
|
221
|
-
/**
|
|
222
|
-
* Retrieves the delay duration for the skeleton display, determining the value based on a hierarchy of overrides and defaults.
|
|
223
|
-
* The method prioritizes in the following order:
|
|
224
|
-
* 1. A finite number set as the `_wjSkeletonSlotClone` property.
|
|
225
|
-
* 2. A valid numeric value from the `skeleton-delay` attribute.
|
|
226
|
-
* 3. The `skeletonDelayMs` property, if defined with a finite number.
|
|
227
|
-
* 4. A default value of 150 if none of the above are set.
|
|
228
|
-
* @returns {number} The delay in milliseconds before the skeleton is displayed.
|
|
229
|
-
*/
|
|
230
|
-
get skeletonDelay(): number;
|
|
231
|
-
set skeletonMinDuration(value: number);
|
|
232
|
-
/**
|
|
233
|
-
* Retrieves the minimum duration for the skeleton animation.
|
|
234
|
-
* The method checks for an internally stored finite value. If unavailable,
|
|
235
|
-
* it retrieves the value from the 'skeleton-min-duration' attribute,
|
|
236
|
-
* converts it to a number if possible, and uses it. If neither is valid,
|
|
237
|
-
* a default duration of 300 is returned.
|
|
238
|
-
* @returns {number} The minimum duration for the skeleton animation in milliseconds.
|
|
239
|
-
*/
|
|
240
|
-
get skeletonMinDuration(): number;
|
|
241
|
-
_wjSkeletonSlotClone: number | Node;
|
|
242
|
-
set skeleton(value: boolean);
|
|
243
|
-
get skeleton(): boolean;
|
|
244
|
-
get skeletonDelayValue(): number;
|
|
245
|
-
/**
|
|
246
|
-
* Lifecycle method invoked when the component is connected to the DOM.
|
|
247
|
-
*/
|
|
248
|
-
connectedCallback(): void;
|
|
249
|
-
/**
|
|
250
|
-
* Initializes the component, setting up attributes and rendering.
|
|
251
|
-
* @param [force] Whether to force initialization.
|
|
252
|
-
* @returns A promise that resolves when initialization is complete.
|
|
253
|
-
*/
|
|
254
|
-
initWjElement: (force?: boolean) => Promise<any>;
|
|
255
|
-
/**
|
|
256
|
-
* Sets up attributes and event listeners for the component.
|
|
257
|
-
* This method retrieves all custom events defined for the component
|
|
258
|
-
* and adds event listeners for each of them. When an event is triggered,
|
|
259
|
-
* it calls the corresponding method on the host element.
|
|
260
|
-
*/
|
|
261
|
-
setupAttributes(): void;
|
|
262
|
-
/**
|
|
263
|
-
* Hook for extending behavior before disconnecting the component.
|
|
264
|
-
*/
|
|
265
|
-
beforeDisconnect(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Hook for extending behavior after disconnecting the component.
|
|
268
|
-
*/
|
|
269
|
-
afterDisconnect(): void;
|
|
270
|
-
/**
|
|
271
|
-
* Hook for extending behavior before redrawing the component.
|
|
272
|
-
*/
|
|
273
|
-
beforeRedraw(): void;
|
|
274
|
-
/**
|
|
275
|
-
* Cleans up resources and event listeners for the component.
|
|
276
|
-
*/
|
|
277
|
-
componentCleanup(): void;
|
|
278
|
-
/**
|
|
279
|
-
* Lifecycle method invoked when the component is disconnected from the DOM.
|
|
280
|
-
*/
|
|
281
|
-
disconnectedCallback(): void;
|
|
282
|
-
/**
|
|
283
|
-
* Lifecycle method invoked when an observed attribute changes.
|
|
284
|
-
* @param name The name of the attribute that changed.
|
|
285
|
-
* @param old The old value of the attribute.
|
|
286
|
-
* @param newName The new value of the attribute.
|
|
287
|
-
*/
|
|
288
|
-
attributeChangedCallback(name: any, old: any, newName: any): void;
|
|
289
|
-
refresh(): void;
|
|
290
|
-
stopRenderLoop(): void;
|
|
291
|
-
/**
|
|
292
|
-
* Displays the component's content, optionally forcing a re-render.
|
|
293
|
-
* @param [force] Whether to force a re-render.
|
|
294
|
-
* @returns A promise that resolves when the display is complete.
|
|
295
|
-
*/
|
|
296
|
-
display(force?: boolean): Promise<void>;
|
|
297
|
-
template: any;
|
|
298
|
-
/**
|
|
299
|
-
* Renders the content into the provided target context.
|
|
300
|
-
* This method handles asynchronous rendering, processes the output from the `draw` method,
|
|
301
|
-
* and appends the resulting content to the specified target context.
|
|
302
|
-
* @returns {Promise<void>} A promise that resolves once the render operation is complete and the content is appended to the target context.
|
|
303
|
-
* @param targetContext
|
|
304
|
-
*/
|
|
305
|
-
render(targetContext?: any): Promise<void>;
|
|
306
|
-
/**
|
|
307
|
-
* Sanitizes a given name by converting it from kebab-case to camelCase.
|
|
308
|
-
* @param {string} name The name in kebab-case format (e.g., "example-name").
|
|
309
|
-
* @returns {string} The sanitized name in camelCase format (e.g., "exampleName").
|
|
310
|
-
* @example
|
|
311
|
-
* sanitizeName('example-name');
|
|
312
|
-
* @example
|
|
313
|
-
* sanitizeName('my-custom-component');
|
|
314
|
-
*/
|
|
315
|
-
sanitizeName(name: string): string;
|
|
316
|
-
/**
|
|
317
|
-
* Checks if a property on an object has a getter or setter method defined.
|
|
318
|
-
* @param {object} obj The object on which the property is defined.
|
|
319
|
-
* @param {string} property The name of the property to check.
|
|
320
|
-
* @returns {object} An object indicating the presence of getter and setter methods.
|
|
321
|
-
* @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.
|
|
322
|
-
* @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.
|
|
323
|
-
* @example
|
|
324
|
-
* const obj = {
|
|
325
|
-
* get name() { return 'value'; },
|
|
326
|
-
* set name(val) { console.log(val); }
|
|
327
|
-
* };
|
|
328
|
-
* checkGetterSetter(obj, 'name');
|
|
329
|
-
* @example
|
|
330
|
-
* const obj = { prop: 42 };
|
|
331
|
-
* checkGetterSetter(obj, 'prop');
|
|
332
|
-
*/
|
|
333
|
-
checkGetterSetter(obj: object, property: string): object;
|
|
334
|
-
/**
|
|
335
|
-
* Sets up property accessors for the component's attributes.
|
|
336
|
-
*/
|
|
337
|
-
setUpAccessors(): void;
|
|
338
|
-
#private;
|
|
339
|
-
}
|
|
340
|
-
export let __esModule: string;
|
|
341
|
-
export { Permissions, WjElementUtils, event };
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { default as WJElement } from '../wje-element/element.js';
|
|
2
|
-
import { Localizer } from '../utils/localize.js';
|
|
3
|
-
/**
|
|
4
|
-
* @summary FileUpload is a custom web component for uploading files.
|
|
5
|
-
* It extends from WJElement and provides functionalities for file upload.
|
|
6
|
-
* @documentation https://elements.webjet.sk/components/file-upload
|
|
7
|
-
* @status stable
|
|
8
|
-
* @augments WJElement
|
|
9
|
-
* @slot - This is a default/unnamed slot.
|
|
10
|
-
* @csspart native - The native file upload part.
|
|
11
|
-
* @csspart file-list - The file list part.
|
|
12
|
-
* @csspart upload-button - The label part.
|
|
13
|
-
* @event change - Fires when the file input changes.
|
|
14
|
-
* @event drop - Fires when a file is dropped into the component.
|
|
15
|
-
* @attribute {string} accepted-types - The accepted file types for upload.
|
|
16
|
-
* @attribute {number} chunk-size - The chunk size for file upload.
|
|
17
|
-
* @attribute {number} max-file-size - The maximum file size for upload.
|
|
18
|
-
* @attribute {string} upload-url - The URL to set as the upload URL.
|
|
19
|
-
* @attribute {boolean} auto-process-files - The auto process files attribute.
|
|
20
|
-
* @attribute {boolean} no-upload-button - The no upload button attribute.
|
|
21
|
-
* @tag wje-file-upload
|
|
22
|
-
*/
|
|
23
|
-
export default class FileUpload extends WJElement {
|
|
24
|
-
/**
|
|
25
|
-
* Getter for cssStyleSheet.
|
|
26
|
-
* @returns {string} The CSS styles for the component.
|
|
27
|
-
*/
|
|
28
|
-
static get cssStyleSheet(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Getter for observedAttributes.
|
|
31
|
-
* @returns {Array} An empty array as no attributes are observed.
|
|
32
|
-
*/
|
|
33
|
-
static get observedAttributes(): any[];
|
|
34
|
-
localizer: Localizer;
|
|
35
|
-
_uploadedFiles: any[];
|
|
36
|
-
_queuedFiles: any[];
|
|
37
|
-
/**
|
|
38
|
-
* Dependencies for the FileUpload component.
|
|
39
|
-
* @type {object}
|
|
40
|
-
*/
|
|
41
|
-
dependencies: object;
|
|
42
|
-
/**
|
|
43
|
-
* Setter for acceptedTypes attribute.
|
|
44
|
-
* @param {string} value The accepted file types for upload.
|
|
45
|
-
*/
|
|
46
|
-
set acceptedTypes(value: string);
|
|
47
|
-
/**
|
|
48
|
-
* Getter for acceptedTypes attribute.
|
|
49
|
-
* @returns {string} The accepted file types for upload.
|
|
50
|
-
*/
|
|
51
|
-
get acceptedTypes(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Setter for chunkSize attribute.
|
|
54
|
-
* @param {number} value The chunk size for file upload.
|
|
55
|
-
*/
|
|
56
|
-
set chunkSize(value: number);
|
|
57
|
-
/**
|
|
58
|
-
* Getter for chunkSize attribute.
|
|
59
|
-
* @returns {number} The chunk size for file upload.
|
|
60
|
-
*/
|
|
61
|
-
get chunkSize(): number;
|
|
62
|
-
/**
|
|
63
|
-
* Setter for maxFileSize attribute.
|
|
64
|
-
* @param {number} value The maximum file size for upload.
|
|
65
|
-
*/
|
|
66
|
-
set maxFileSize(value: number);
|
|
67
|
-
/**
|
|
68
|
-
* Getter for maxFileSize attribute.
|
|
69
|
-
* @returns {number} The maximum file size for upload.
|
|
70
|
-
*/
|
|
71
|
-
get maxFileSize(): number;
|
|
72
|
-
/**
|
|
73
|
-
* Setter for label attribute.
|
|
74
|
-
* @param {string} value The URL to set as the upload URL.
|
|
75
|
-
*/
|
|
76
|
-
set uploadUrl(value: string);
|
|
77
|
-
/**
|
|
78
|
-
* Gets the upload URL for the file upload element.
|
|
79
|
-
* @returns {string} The upload URL for the file upload element.
|
|
80
|
-
*/
|
|
81
|
-
get uploadUrl(): string;
|
|
82
|
-
/**
|
|
83
|
-
* Sets the autoProcessFiles attribute.
|
|
84
|
-
* @param value
|
|
85
|
-
*/
|
|
86
|
-
set autoProcessFiles(value: any | boolean);
|
|
87
|
-
/**
|
|
88
|
-
* Gets the autoProcessFiles attribute.
|
|
89
|
-
* @returns {any|boolean}
|
|
90
|
-
*/
|
|
91
|
-
get autoProcessFiles(): any | boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the noUploadButton attribute.
|
|
94
|
-
* @param value
|
|
95
|
-
*/
|
|
96
|
-
set noUploadButton(value: boolean);
|
|
97
|
-
/**
|
|
98
|
-
* Gets the noUploadButton attribute.
|
|
99
|
-
* @returns {boolean}
|
|
100
|
-
*/
|
|
101
|
-
get noUploadButton(): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Sets the uploaded files.
|
|
104
|
-
* @param value
|
|
105
|
-
*/
|
|
106
|
-
set uploadedFiles(value: []);
|
|
107
|
-
/**
|
|
108
|
-
* Return the uploaded files.
|
|
109
|
-
* @returns {[]}
|
|
110
|
-
*/
|
|
111
|
-
get uploadedFiles(): [];
|
|
112
|
-
/**
|
|
113
|
-
* Sets the to-chunk attribute.
|
|
114
|
-
* @param value
|
|
115
|
-
*/
|
|
116
|
-
set toChunk(value: boolean);
|
|
117
|
-
/**
|
|
118
|
-
* Gets the to-chunk attribute.
|
|
119
|
-
* @returns {boolean}
|
|
120
|
-
*/
|
|
121
|
-
get toChunk(): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Sets the maximum number of files that can be uploaded or managed.
|
|
124
|
-
* Assigns the specified value to the 'max-files' attribute.
|
|
125
|
-
* @param {number} value The maximum allowable number of files.
|
|
126
|
-
*/
|
|
127
|
-
set maxFiles(value: number);
|
|
128
|
-
/**
|
|
129
|
-
* Retrieves the maximum number of files allowed from the `max-files` attribute.
|
|
130
|
-
* If the attribute is not set or is invalid, defaults to 0.
|
|
131
|
-
* @returns {number} The maximum number of files allowed.
|
|
132
|
-
*/
|
|
133
|
-
get maxFiles(): number;
|
|
134
|
-
beforeDraw(): void;
|
|
135
|
-
uploadFunction: Function;
|
|
136
|
-
/**
|
|
137
|
-
* Method to draw the component on the screen.
|
|
138
|
-
* @returns {DocumentFragment} The fragment containing the component.
|
|
139
|
-
*/
|
|
140
|
-
draw(): DocumentFragment;
|
|
141
|
-
button: HTMLElement;
|
|
142
|
-
native: HTMLDivElement;
|
|
143
|
-
fileList: HTMLSlotElement;
|
|
144
|
-
fileInput: HTMLInputElement;
|
|
145
|
-
/**
|
|
146
|
-
* Method to perform actions after the component is drawn.
|
|
147
|
-
*/
|
|
148
|
-
afterDraw(): void;
|
|
149
|
-
/**
|
|
150
|
-
* Method to handle form submission.
|
|
151
|
-
* @param {Event} event The form submission event.
|
|
152
|
-
*/
|
|
153
|
-
handleSubmit(event: Event): void;
|
|
154
|
-
/**
|
|
155
|
-
* Method to handle file drop event.
|
|
156
|
-
* @param {Event} event The file drop event object.
|
|
157
|
-
*/
|
|
158
|
-
handleDrop: (event: Event) => void;
|
|
159
|
-
/**
|
|
160
|
-
* Method to handle file input change event.
|
|
161
|
-
* @param {Event} event The file input change event object.
|
|
162
|
-
*/
|
|
163
|
-
handleInputChange: (event: Event) => void;
|
|
164
|
-
/**
|
|
165
|
-
* Method to add files to the queue.
|
|
166
|
-
* @param files
|
|
167
|
-
*/
|
|
168
|
-
addFilesToQueue(files: any): void;
|
|
169
|
-
/**
|
|
170
|
-
* Method to upload files.
|
|
171
|
-
*/
|
|
172
|
-
uploadFiles(): void;
|
|
173
|
-
/**
|
|
174
|
-
* Method to create an upload promise.
|
|
175
|
-
* @param file
|
|
176
|
-
* @returns {Promise<unknown>}
|
|
177
|
-
*/
|
|
178
|
-
createUploadPromise: (file: any) => Promise<unknown>;
|
|
179
|
-
/**
|
|
180
|
-
* Method to create a preview for the file.
|
|
181
|
-
* @param {File} file The file for which the preview is to be created.
|
|
182
|
-
* @param {FileReader} reader The FileReader instance to read the file.
|
|
183
|
-
* @returns {HTMLElement} The created preview.
|
|
184
|
-
*/
|
|
185
|
-
createPreview(file: File, reader: FileReader): HTMLElement;
|
|
186
|
-
/**
|
|
187
|
-
* Method to create a thumbnail for the file.
|
|
188
|
-
* @param {File} file The file for which the thumbnail is to be created.
|
|
189
|
-
* @param {FileReader} reader The FileReader instance to read the file.
|
|
190
|
-
* @returns {HTMLElement} The created thumbnail.
|
|
191
|
-
*/
|
|
192
|
-
createThumbnail(file: File, reader: FileReader): HTMLElement;
|
|
193
|
-
/**
|
|
194
|
-
* Method to validate the files.
|
|
195
|
-
* @param {File} file The file to be validated.
|
|
196
|
-
* TODO: alowed types a size limit by malo byt cez attributy
|
|
197
|
-
*/
|
|
198
|
-
assertFilesValid(file: File): void;
|
|
199
|
-
/**
|
|
200
|
-
* Method to reset the form state.
|
|
201
|
-
*/
|
|
202
|
-
resetFormState(): void;
|
|
203
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves the icon name for a given file type.
|
|
3
|
-
* @param {string} type The file type or category (e.g., "pdf", "image", "folder").
|
|
4
|
-
* @returns {string} The name of the icon associated with the file type.
|
|
5
|
-
* @example
|
|
6
|
-
* getFileTypeIcon('pdf'); // Returns the icon name for PDF files.
|
|
7
|
-
* getFileTypeIcon('folder'); // Returns 'folder'.
|
|
8
|
-
*/
|
|
9
|
-
export function getFileTypeIcon(type: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a given file matches any of the accepted file types.
|
|
12
|
-
* @param {File} file The file to validate.
|
|
13
|
-
* @param {string|string[]} acceptedFileTypes A comma-separated string or an array of accepted MIME types or file extensions.
|
|
14
|
-
* @returns {boolean} Returns `true` if the file type is valid, otherwise `false`.
|
|
15
|
-
* @throws {Error} Throws an error if `acceptedFileTypes` is empty.
|
|
16
|
-
* @example
|
|
17
|
-
* const file = new File([""], "example.png", { type: "image/png" });
|
|
18
|
-
* const isValid = isValidFileType(file, "image/*,application/pdf");
|
|
19
|
-
* console.log(isValid); // true
|
|
20
|
-
* @example
|
|
21
|
-
* const file = new File([""], "example.txt", { type: "text/plain" });
|
|
22
|
-
* const isValid = isValidFileType(file, ["text/plain", "application/json"]);
|
|
23
|
-
* console.log(isValid); // true
|
|
24
|
-
*/
|
|
25
|
-
export function isValidFileType(file: File, acceptedFileTypes: string | string[]): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Uploads a file in chunks using `XMLHttpRequest`, allowing for progress tracking.
|
|
28
|
-
* @param {File} file The file to be uploaded.
|
|
29
|
-
* @param {number} chunkSize The size of each chunk in bytes.
|
|
30
|
-
* @param {HTMLElement} preview The element used to display upload progress.
|
|
31
|
-
*/
|
|
32
|
-
export function uploadFile(file: File, chunkSize: number, preview: HTMLElement): void;
|
|
33
|
-
/**
|
|
34
|
-
* Returns a function for uploading files either in chunks or as a whole file, based on the provided options.
|
|
35
|
-
* @param {string} url The URL to which the file will be uploaded.
|
|
36
|
-
* @param {number} [chunkSize] The size of each chunk in bytes when uploading in chunks (default is 1MB).
|
|
37
|
-
* @param {boolean} [wholeFile] Whether to upload the file as a whole. If `true`, the entire file is uploaded at once.
|
|
38
|
-
* @returns {Function} A function that takes a file and a preview element as arguments and uploads the file.
|
|
39
|
-
* @example
|
|
40
|
-
* // Upload a file in chunks
|
|
41
|
-
* const uploadInChunks = upload('/upload', 1024 * 512); // 512KB chunks
|
|
42
|
-
* uploadInChunks(file, previewElement);
|
|
43
|
-
* @example
|
|
44
|
-
* // Upload a whole file
|
|
45
|
-
* const uploadWhole = upload('/upload', undefined, true);
|
|
46
|
-
* uploadWhole(file, previewElement);
|
|
47
|
-
*/
|
|
48
|
-
export function upload(url: string, chunkSize?: number, wholeFile?: boolean): Function;
|
|
49
|
-
/**
|
|
50
|
-
* Uploads a file in chunks to a specified URL, allowing for progress tracking and resuming in case of errors.
|
|
51
|
-
* @param {string} url The URL to which the file chunks will be uploaded.
|
|
52
|
-
* @param {File} file The file to be uploaded in chunks.
|
|
53
|
-
* @param {HTMLElement} preview The element used to display upload progress.
|
|
54
|
-
* @param {number} [chunkSize] The size of each chunk in bytes (default is 1MB).
|
|
55
|
-
* @returns {Promise<object>} Resolves with the response of the last chunk uploaded, parsed as JSON.
|
|
56
|
-
* @throws {Error} - Throws an error if a chunk fails to upload.
|
|
57
|
-
*/
|
|
58
|
-
export function uploadFileInChunks(url: string, file: File, preview: HTMLElement, chunkSize?: number): Promise<object>;
|
|
59
|
-
/**
|
|
60
|
-
* Uploads a file to a specified URL using a `POST` request and updates the preview element with the uploaded file size.
|
|
61
|
-
* @param {string} url The URL to which the file will be uploaded.
|
|
62
|
-
* @param {File} file The file to be uploaded.
|
|
63
|
-
* @param {HTMLElement} preview The element that displays the upload preview. It will be updated with the file size.
|
|
64
|
-
* @returns {Promise<{data: object, file: File}>} - A promise that resolves with the server response and the uploaded file.
|
|
65
|
-
* @throws {Error} - Logs an error to the console if the request fails.
|
|
66
|
-
*/
|
|
67
|
-
export function uploadWholeFile(url: string, file: File, preview: HTMLElement): Promise<{
|
|
68
|
-
data: object;
|
|
69
|
-
file: File;
|
|
70
|
-
}>;
|