@theseam/ui-common 1.0.2-beta.59 → 1.0.2-beta.63
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/fesm2022/theseam-ui-common-file-input.mjs +537 -0
- package/fesm2022/theseam-ui-common-file-input.mjs.map +1 -0
- package/fesm2022/theseam-ui-common-signature-input.mjs +179 -66
- package/fesm2022/theseam-ui-common-signature-input.mjs.map +1 -1
- package/file-input/index.d.ts +190 -0
- package/file-input/package.json +3 -0
- package/package.json +5 -1
- package/signature-input/index.d.ts +71 -17
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _almothafar_angular_signature_pad from '@almothafar/angular-signature-pad';
|
|
2
2
|
import { NgSignaturePadOptions } from '@almothafar/angular-signature-pad';
|
|
3
3
|
import * as _angular_core from '@angular/core';
|
|
4
|
-
import { InjectionToken, AfterViewInit } from '@angular/core';
|
|
4
|
+
import { InjectionToken, AfterViewInit, EventEmitter } from '@angular/core';
|
|
5
5
|
import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
|
|
6
6
|
import { FormGroup, FormControl, ControlValueAccessor } from '@angular/forms';
|
|
7
|
-
import {
|
|
7
|
+
import { ModalConfig } from '@theseam/ui-common/modal';
|
|
8
8
|
import * as _angular_cdk_testing from '@angular/cdk/testing';
|
|
9
|
-
import { ComponentHarness, TestElement } from '@angular/cdk/testing';
|
|
9
|
+
import { ComponentHarness, TestElement, BaseHarnessFilters, HarnessPredicate } from '@angular/cdk/testing';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options for `szimek/signature_pad` exposed by
|
|
@@ -152,24 +152,13 @@ declare class TheSeamSignatureInputImgComponent implements ControlValueAccessor,
|
|
|
152
152
|
static readonly MAX_FILE_SIZE: number;
|
|
153
153
|
private readonly _container;
|
|
154
154
|
private readonly _destroyRef;
|
|
155
|
-
/**
|
|
156
|
-
* The File is only needed for validation at selection time. Once it's been
|
|
157
|
-
* converted to a data URL and stored in the form value, we don't need the
|
|
158
|
-
* File again — so there's no point trying to round-trip it through
|
|
159
|
-
* writeValue / form state. The preview renders off the current form value.
|
|
160
|
-
*/
|
|
161
155
|
protected readonly _fileControl: FormControl<File | null>;
|
|
162
156
|
private readonly _fileStatus;
|
|
163
157
|
protected readonly _sizeError: _angular_core.Signal<string | null>;
|
|
164
|
-
/**
|
|
165
|
-
* Single source of truth for both the form value and the preview image.
|
|
166
|
-
* External writes (writeValue) and successful uploads both funnel through
|
|
167
|
-
* here, so switching tabs and coming back always shows the last committed
|
|
168
|
-
* signature.
|
|
169
|
-
*/
|
|
170
158
|
private readonly _value;
|
|
171
159
|
protected readonly _previewDataUrl: _angular_core.Signal<string | null>;
|
|
172
160
|
protected readonly _previewBackgroundImage: _angular_core.Signal<string | null>;
|
|
161
|
+
private readonly _nativeInput;
|
|
173
162
|
private _onChange;
|
|
174
163
|
private _onTouched;
|
|
175
164
|
constructor();
|
|
@@ -179,12 +168,66 @@ declare class TheSeamSignatureInputImgComponent implements ControlValueAccessor,
|
|
|
179
168
|
setDisabledState(isDisabled: boolean): void;
|
|
180
169
|
clear(): void;
|
|
181
170
|
openFileBrowse(): void;
|
|
182
|
-
protected
|
|
171
|
+
protected _onFilesDropped(files: File[]): void;
|
|
172
|
+
protected _onNativeChange(event: Event): void;
|
|
183
173
|
private _setValue;
|
|
184
174
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheSeamSignatureInputImgComponent, never>;
|
|
185
175
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TheSeamSignatureInputImgComponent, "seam-signature-input-img", never, {}, {}, never, never, true, never>;
|
|
186
176
|
}
|
|
187
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Opens the signature input panel in a modal when the host button/anchor is
|
|
180
|
+
* clicked, and writes the submitted data URL back through its bound form
|
|
181
|
+
* control. Implements `ControlValueAccessor` so it works with any of the form
|
|
182
|
+
* binding styles (`formControl`, `formControlName`, `ngModel`).
|
|
183
|
+
*
|
|
184
|
+
* Usage:
|
|
185
|
+
*
|
|
186
|
+
* ```html
|
|
187
|
+
* <button seamButton theme="primary" seamSignatureInput formControlName="signature">
|
|
188
|
+
* Sign
|
|
189
|
+
* </button>
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* The selector-name input accepts a partial `ModalConfig` for cases that need
|
|
193
|
+
* to tweak the modal (e.g. `disableClose`):
|
|
194
|
+
*
|
|
195
|
+
* ```html
|
|
196
|
+
* <button
|
|
197
|
+
* seamButton
|
|
198
|
+
* [seamSignatureInput]="{ disableClose: true }"
|
|
199
|
+
* formControlName="signature"
|
|
200
|
+
* >Sign</button>
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
declare class TheSeamSignatureInputButtonDirective implements ControlValueAccessor {
|
|
204
|
+
private readonly _modal;
|
|
205
|
+
private readonly _elementRef;
|
|
206
|
+
private readonly _seamButton;
|
|
207
|
+
private readonly _seamAnchor;
|
|
208
|
+
/**
|
|
209
|
+
* Partial `ModalConfig` passthrough. Most consumers leave this unset; the
|
|
210
|
+
* signature panel's styles assume the default modal size.
|
|
211
|
+
*/
|
|
212
|
+
modalConfig: ModalConfig | null | undefined;
|
|
213
|
+
/** Emits the submitted data URL when the user applies a signature. */
|
|
214
|
+
signed: EventEmitter<string>;
|
|
215
|
+
/** Emits when the user dismisses the panel without submitting. */
|
|
216
|
+
canceled: EventEmitter<void>;
|
|
217
|
+
private _value;
|
|
218
|
+
private _disabled;
|
|
219
|
+
private _onChange;
|
|
220
|
+
private _onTouched;
|
|
221
|
+
writeValue(value: string | null): void;
|
|
222
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
223
|
+
registerOnTouched(fn: () => void): void;
|
|
224
|
+
setDisabledState(isDisabled: boolean): void;
|
|
225
|
+
/** @ignore */
|
|
226
|
+
_onClick(): void;
|
|
227
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TheSeamSignatureInputButtonDirective, never>;
|
|
228
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TheSeamSignatureInputButtonDirective, "button[seamSignatureInput], a[seamSignatureInput]", ["seamSignatureInput"], { "modalConfig": { "alias": "seamSignatureInput"; "required": false; }; }, { "signed": "signed"; "canceled": "canceled"; }, never, never, true, never>;
|
|
229
|
+
}
|
|
230
|
+
|
|
188
231
|
declare class TheSeamSignatureInputImgHarness extends ComponentHarness {
|
|
189
232
|
static hostSelector: string;
|
|
190
233
|
private readonly _fileDrop;
|
|
@@ -237,5 +280,16 @@ declare class TheSeamSignatureInputPanelHarness extends ComponentHarness {
|
|
|
237
280
|
submit(): Promise<void>;
|
|
238
281
|
}
|
|
239
282
|
|
|
240
|
-
|
|
283
|
+
interface SignatureInputButtonHarnessFilters extends BaseHarnessFilters {
|
|
284
|
+
text?: string | RegExp;
|
|
285
|
+
}
|
|
286
|
+
declare class TheSeamSignatureInputButtonHarness extends ComponentHarness {
|
|
287
|
+
static hostSelector: string;
|
|
288
|
+
static with(options?: SignatureInputButtonHarnessFilters): HarnessPredicate<TheSeamSignatureInputButtonHarness>;
|
|
289
|
+
getText(): Promise<string>;
|
|
290
|
+
isDisabled(): Promise<boolean>;
|
|
291
|
+
click(): Promise<void>;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { THESEAM_SIGNATURE_INPUT_CONTAINER, TheSeamSignatureInputButtonDirective, TheSeamSignatureInputButtonHarness, TheSeamSignatureInputImgComponent, TheSeamSignatureInputImgHarness, TheSeamSignatureInputPanelComponent, TheSeamSignatureInputPanelHarness, TheSeamSignatureInputPenComponent, TheSeamSignatureInputPenHarness, TheSeamSignatureInputTextComponent, TheSeamSignatureInputTextHarness };
|
|
241
295
|
export type { SignatureFontState, SignatureInputContainer, SignatureInputItem, SignatureInputOptions, SignatureInputPanelResult, SignatureInputResetType, SignatureInputType, SignaturePadOptions };
|