Skip to content

Commit

Permalink
v1.0.4 toggle button for Elegant UI type
Browse files Browse the repository at this point in the history
  • Loading branch information
paulosabayomi committed Feb 11, 2024
1 parent c08bc40 commit 4bdbe0d
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 48 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/auto-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
{
"badge": "https://img.shields.io/badge/logo-typescript-blue?logo=typescript",
"alt": "TypeScript",
"link": "${{ env.repo_url }}/actions/workflows/test-ts.js.yml"
"link": "https://typescriptlang.org"
},
{
"badge": "https://github.com/paulosabayomi/CustUp/actions/workflows/test-ts.js.yml/badge.svg",
Expand Down
Binary file modified _assets/.DS_Store
Binary file not shown.
17 changes: 15 additions & 2 deletions core/custupCore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class CustUpCore {
* minNumberOfFiles?: number;
* minimumAllowedFileSize?: number;
* maximumAllowedFileSize?: number;
* ui_type?: 'default' | 'resumeUploaderUI' | 'bare' | 'detached' | 'profilePicture';
* ui_type?: 'default' | 'resumeUploaderUI' | 'bare' | 'detached' | 'profilePicture' | 'elegant';
* display_ui_tools?: boolean;
* show_ui_tools_on_mobile_devices?: boolean;
* disable_drag_n_drop?: boolean;
Expand Down Expand Up @@ -357,7 +357,7 @@ export default class CustUpCore {
minNumberOfFiles?: number | undefined;
minimumAllowedFileSize?: number | undefined;
maximumAllowedFileSize?: number | undefined;
ui_type?: "default" | "resumeUploaderUI" | "bare" | "detached" | "profilePicture" | undefined;
ui_type?: "default" | "resumeUploaderUI" | "bare" | "detached" | "profilePicture" | "elegant" | undefined;
display_ui_tools?: boolean | undefined;
show_ui_tools_on_mobile_devices?: boolean | undefined;
disable_drag_n_drop?: boolean | undefined;
Expand Down Expand Up @@ -666,6 +666,10 @@ export default class CustUpCore {
* @private @property {Array} file_preview_animation_arr
*/
private file_preview_animation_arr;
/**
* @private @property {boolean} is_default_ui_shown
*/
private is_default_ui_shown;
/**
* @private @property {Object} previewerAnimations
*/
Expand Down Expand Up @@ -1334,6 +1338,15 @@ export default class CustUpCore {
* @method close_file_source_popup
*/
close_file_source_popup(): void;
/**
* @method hide_add_file_ui
*/
hide_add_file_ui(): void;
/**
* @method is_add_file_ui_shown
* @returns {boolean}
*/
is_add_file_ui_shown(): boolean;
/**
* @method get_file_sources - Returns all the allowed file sources icons wrapped in HTML element
* @param {HTMLElement | null} iconsContainer - An HTML element to automatically append the icons to
Expand Down
2 changes: 1 addition & 1 deletion core/custupCore.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion core/custupCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ export default class CustUpCore {
*/
file_preview_animation_arr = []; // Custup close popup btn

/**
* @private @property {boolean} is_default_ui_shown
*/
is_default_ui_shown = undefined; // Custup close popup btn

/**
* @private @property {Object} previewerAnimations
*/
Expand Down Expand Up @@ -437,7 +442,7 @@ export default class CustUpCore {
* minNumberOfFiles?: number;
* minimumAllowedFileSize?: number;
* maximumAllowedFileSize?: number;
* ui_type?: 'default' | 'resumeUploaderUI' | 'bare' | 'detached' | 'profilePicture';
* ui_type?: 'default' | 'resumeUploaderUI' | 'bare' | 'detached' | 'profilePicture' | 'elegant';
* display_ui_tools?: boolean;
* show_ui_tools_on_mobile_devices?: boolean;
* disable_drag_n_drop?: boolean;
Expand Down Expand Up @@ -1086,6 +1091,7 @@ export default class CustUpCore {
this._custupInnerEl.append(this._custupDefaultUIEl);
!this.options.disable_select_files_from_device && (this._custupDefaultUIEl.onclick = (e) => this._select_file_from_device(e));
this.eventMethods.default_ui_shown && this.eventMethods.default_ui_shown();
this.is_default_ui_shown = true;
}


Expand All @@ -1097,6 +1103,7 @@ export default class CustUpCore {
this._custupDefaultUIEl.remove();
this._custupDefaultUIEl = undefined;
this.eventMethods.default_ui_closed && this.eventMethods.default_ui_closed();
this.is_default_ui_shown = false;
}
}

Expand Down Expand Up @@ -1229,6 +1236,7 @@ export default class CustUpCore {
* @param {HTMLElement} el
*/
set_scroll_pointer_event (el, targetEl=undefined, targetScrollBarEl=undefined) {
if (el == undefined) return;
el.ontouchstart = (e) => {
e.stopPropagation();
this.layerMoved = e.layerY
Expand Down Expand Up @@ -2833,6 +2841,21 @@ export default class CustUpCore {
this._custup_media_source_instance?.closeMediaPopup(true); // destroy CustUpMediaSource instance if already exists
}

/**
* @method hide_add_file_ui
*/
hide_add_file_ui () {
this.removeDefaultUI();
}

/**
* @method is_add_file_ui_shown
* @returns {boolean}
*/
is_add_file_ui_shown () {
return this.is_default_ui_shown;
}

/**
* @method get_file_sources - Returns all the allowed file sources icons wrapped in HTML element
* @param {HTMLElement | null} iconsContainer - An HTML element to automatically append the icons to
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custup",
"version": "1.0.3",
"version": "1.0.4",
"description": "Highly customisable file upload library with zero dependencies",
"main": "src/custup.min.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/all.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 4bdbe0d

Please sign in to comment.