gd-bs 6.6.85 → 6.6.87
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/build/components/dropdown/index.js +1 -9
- package/build/components/form/control.js +14 -0
- package/build/components/inputGroup/index.js +68 -4
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +12 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/index.ts +1 -9
- package/src/components/form/control.ts +14 -0
- package/src/components/form/controlTypes.d.ts +3 -1
- package/src/components/inputGroup/index.ts +63 -1
- package/src/components/inputGroup/types.d.ts +9 -0
package/package.json
CHANGED
|
@@ -455,15 +455,7 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
// Find the item
|
|
458
|
-
let item = this.props.items?.find((item) => {
|
|
459
|
-
// Match by the text property if the value doesn't exist
|
|
460
|
-
if (typeof (item.value) === undefined) { return item.text == currentItem.text; }
|
|
461
|
-
|
|
462
|
-
// See if the value property matches
|
|
463
|
-
return item.value == currentItem.value;
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
// See if an item was found
|
|
458
|
+
let item = this.props.items?.find((item) => { return item.value == currentValue || item.text == currentValue; });
|
|
467
459
|
if (item) {
|
|
468
460
|
// Add the text property
|
|
469
461
|
values.push(item.text);
|
|
@@ -134,6 +134,7 @@ export class FormControl implements IFormControl {
|
|
|
134
134
|
case FormControlTypes.ColorPicker:
|
|
135
135
|
// Add the input
|
|
136
136
|
this._tb = InputGroup({
|
|
137
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
137
138
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
138
139
|
className,
|
|
139
140
|
id: this._props.id,
|
|
@@ -141,6 +142,7 @@ export class FormControl implements IFormControl {
|
|
|
141
142
|
isReadonly: this._props.isReadonly,
|
|
142
143
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
143
144
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
145
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
144
146
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
145
147
|
required: this._props.required,
|
|
146
148
|
title: this._props.title,
|
|
@@ -221,6 +223,7 @@ export class FormControl implements IFormControl {
|
|
|
221
223
|
case FormControlTypes.Email:
|
|
222
224
|
// Add the input
|
|
223
225
|
this._tb = InputGroup({
|
|
226
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
224
227
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
225
228
|
className,
|
|
226
229
|
id: this._props.id,
|
|
@@ -228,6 +231,7 @@ export class FormControl implements IFormControl {
|
|
|
228
231
|
isReadonly: this._props.isReadonly,
|
|
229
232
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
230
233
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
234
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
231
235
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
232
236
|
required: this._props.required,
|
|
233
237
|
title: this._props.title,
|
|
@@ -239,6 +243,7 @@ export class FormControl implements IFormControl {
|
|
|
239
243
|
case FormControlTypes.File:
|
|
240
244
|
// Add the input
|
|
241
245
|
this._tb = InputGroup({
|
|
246
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
242
247
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
243
248
|
className,
|
|
244
249
|
id: this._props.id,
|
|
@@ -246,6 +251,7 @@ export class FormControl implements IFormControl {
|
|
|
246
251
|
isReadonly: this._props.isReadonly,
|
|
247
252
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
248
253
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
254
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
249
255
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
250
256
|
required: this._props.required,
|
|
251
257
|
title: this._props.title,
|
|
@@ -398,6 +404,7 @@ export class FormControl implements IFormControl {
|
|
|
398
404
|
case FormControlTypes.Password:
|
|
399
405
|
// Add the input
|
|
400
406
|
this._tb = InputGroup({
|
|
407
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
401
408
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
402
409
|
className,
|
|
403
410
|
id: this._props.id,
|
|
@@ -405,6 +412,7 @@ export class FormControl implements IFormControl {
|
|
|
405
412
|
isReadonly: this._props.isReadonly,
|
|
406
413
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
407
414
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
415
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
408
416
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
409
417
|
required: this._props.required,
|
|
410
418
|
title: this._props.title,
|
|
@@ -453,6 +461,7 @@ export class FormControl implements IFormControl {
|
|
|
453
461
|
case FormControlTypes.Readonly:
|
|
454
462
|
// Add the input
|
|
455
463
|
this._tb = InputGroup({
|
|
464
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
456
465
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
457
466
|
className,
|
|
458
467
|
id: this._props.id,
|
|
@@ -460,6 +469,7 @@ export class FormControl implements IFormControl {
|
|
|
460
469
|
isReadonly: true,
|
|
461
470
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
462
471
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
472
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
463
473
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
464
474
|
required: this._props.required,
|
|
465
475
|
title: this._props.title,
|
|
@@ -489,6 +499,7 @@ export class FormControl implements IFormControl {
|
|
|
489
499
|
case FormControlTypes.TextArea:
|
|
490
500
|
// Add the input
|
|
491
501
|
this._tb = InputGroup({
|
|
502
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
492
503
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
493
504
|
className,
|
|
494
505
|
id: this._props.id,
|
|
@@ -496,6 +507,7 @@ export class FormControl implements IFormControl {
|
|
|
496
507
|
isReadonly: this._props.isReadonly,
|
|
497
508
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
498
509
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
510
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
499
511
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
500
512
|
required: this._props.required,
|
|
501
513
|
rows: (this._props as IFormControlPropsTextField).rows,
|
|
@@ -508,6 +520,7 @@ export class FormControl implements IFormControl {
|
|
|
508
520
|
case FormControlTypes.TextField:
|
|
509
521
|
// Add the input
|
|
510
522
|
this._tb = InputGroup({
|
|
523
|
+
appendedDropdown: (this.props as IFormControlPropsTextField).appendedDropdown,
|
|
511
524
|
appendedLabel: (this.props as IFormControlPropsTextField).appendedLabel,
|
|
512
525
|
className,
|
|
513
526
|
id: this._props.id,
|
|
@@ -515,6 +528,7 @@ export class FormControl implements IFormControl {
|
|
|
515
528
|
isReadonly: this._props.isReadonly,
|
|
516
529
|
onChange: (this._props as IFormControlPropsTextField).onChange,
|
|
517
530
|
placeholder: (this._props as IFormControlPropsTextField).placeholder,
|
|
531
|
+
prependedDropdown: (this.props as IFormControlPropsTextField).prependedDropdown,
|
|
518
532
|
prependedLabel: (this.props as IFormControlPropsTextField).prependedLabel,
|
|
519
533
|
required: this._props.required,
|
|
520
534
|
title: this._props.title,
|
|
@@ -22,7 +22,7 @@ export const FormControl: (props: IFormControlProps) => IFormControl;
|
|
|
22
22
|
|
|
23
23
|
import { IBaseProps } from "../types";
|
|
24
24
|
import { ICheckboxGroup, ICheckboxGroupItem } from "../checkboxGroup/types";
|
|
25
|
-
import { IDropdown, IDropdownItem } from "../dropdown/types";
|
|
25
|
+
import { IDropdown, IDropdownItem, IDropdownProps } from "../dropdown/types";
|
|
26
26
|
import { IInputGroup } from "../inputGroup/types";
|
|
27
27
|
import { IListBox } from "../listBox/types";
|
|
28
28
|
import { IPopoverProps } from "../popover/types";
|
|
@@ -228,6 +228,7 @@ export interface IFormControlPropsSwitch extends IFormControlPropsCheckbox { }
|
|
|
228
228
|
* Form Control Properties - TextField
|
|
229
229
|
*/
|
|
230
230
|
export interface IFormControlPropsTextField extends IFormControlProps {
|
|
231
|
+
appendedDropdown?: IDropdownProps;
|
|
231
232
|
appendedLabel?: string;
|
|
232
233
|
el?: HTMLInputElement;
|
|
233
234
|
onChange?: (value: string, ev?: Event) => void;
|
|
@@ -235,6 +236,7 @@ export interface IFormControlPropsTextField extends IFormControlProps {
|
|
|
235
236
|
onGetValue?: (control: IFormControlPropsTextField) => any;
|
|
236
237
|
onValidate?: (control: IFormControlPropsTextField, results: IFormControlValidationResult<string>) => boolean | IFormControlValidationResult<string>;
|
|
237
238
|
placeholder?: string;
|
|
239
|
+
prependedDropdown?: IDropdownProps;
|
|
238
240
|
prependedLabel?: string;
|
|
239
241
|
rows?: number;
|
|
240
242
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IInputGroup, IInputGroupFileValue, IInputGroupProps } from "./types";
|
|
2
2
|
import { Base } from "../base";
|
|
3
3
|
import { Button } from "../button";
|
|
4
|
+
import { Dropdown } from "../dropdown";
|
|
5
|
+
import { IDropdown, IDropdownItem } from "../dropdown/types";
|
|
4
6
|
import { HTML } from "./templates";
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -22,6 +24,8 @@ export enum InputGroupTypes {
|
|
|
22
24
|
* @param props The input group properties.
|
|
23
25
|
*/
|
|
24
26
|
class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
|
|
27
|
+
private _ddlAppended: IDropdown = null;
|
|
28
|
+
private _ddlPrepended: IDropdown = null;
|
|
25
29
|
private _fileValue: IInputGroupFileValue = null;
|
|
26
30
|
private _initFl: boolean = false;
|
|
27
31
|
|
|
@@ -80,6 +84,13 @@ class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
|
|
|
80
84
|
this.el.insertBefore(Button(buttons[i]).el, elInput);
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
// See if there is a dropdown
|
|
88
|
+
if (this.props.prependedDropdown) {
|
|
89
|
+
// Add the dropdown
|
|
90
|
+
this._ddlPrepended = Dropdown(this.props.prependedDropdown);
|
|
91
|
+
this.el.appendChild(this._ddlPrepended.el);
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
// Default the appended buttons
|
|
84
95
|
let appendedButtons = this.props.appendedButtons || [];
|
|
85
96
|
if (this.props.type == InputGroupTypes.Range) {
|
|
@@ -104,6 +115,13 @@ class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
|
|
|
104
115
|
// Add the button
|
|
105
116
|
this.el.appendChild(Button(appendedButtons[i]).el);
|
|
106
117
|
}
|
|
118
|
+
|
|
119
|
+
// See if there is a dropdown
|
|
120
|
+
if (this.props.appendedDropdown) {
|
|
121
|
+
// Add the dropdown
|
|
122
|
+
this._ddlAppended = Dropdown(this.props.appendedDropdown);
|
|
123
|
+
this.el.appendChild(this._ddlAppended.el);
|
|
124
|
+
}
|
|
107
125
|
}
|
|
108
126
|
}
|
|
109
127
|
|
|
@@ -289,9 +307,53 @@ class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
|
|
|
289
307
|
* Public Interface
|
|
290
308
|
*/
|
|
291
309
|
|
|
310
|
+
get appendedDropdown() { return this._ddlAppended; }
|
|
311
|
+
|
|
292
312
|
getFileInfo() { return this._fileValue; }
|
|
293
313
|
|
|
294
|
-
getValue() {
|
|
314
|
+
getValue() {
|
|
315
|
+
let value = "";
|
|
316
|
+
|
|
317
|
+
// See if a prepended dropdown exist
|
|
318
|
+
if (this._ddlPrepended) {
|
|
319
|
+
// See if this is a multi item
|
|
320
|
+
if (this.props.prependedDropdown.multi) {
|
|
321
|
+
// Set the value
|
|
322
|
+
let items = this._ddlPrepended.getValue() as IDropdownItem[];
|
|
323
|
+
for (let i = 0; i < items.length; i++) {
|
|
324
|
+
// Add the value
|
|
325
|
+
value += items[i].value;
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
// Set the value
|
|
329
|
+
value += (this._ddlPrepended.getValue() as IDropdownItem)?.value;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Append the input value
|
|
334
|
+
value += this.elTextbox.value;
|
|
335
|
+
|
|
336
|
+
// See if a appended dropdown exist
|
|
337
|
+
if (this._ddlAppended) {
|
|
338
|
+
// See if this is a multi item
|
|
339
|
+
if (this.props.appendedDropdown.multi) {
|
|
340
|
+
// Set the value
|
|
341
|
+
let items = this._ddlAppended.getValue() as IDropdownItem[];
|
|
342
|
+
for (let i = 0; i < items.length; i++) {
|
|
343
|
+
// Add the value
|
|
344
|
+
value += items[i].value;
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
// Set the value
|
|
348
|
+
value += (this._ddlAppended.getValue() as IDropdownItem)?.value;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Return the value
|
|
353
|
+
return value;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
get prependedDropdown() { return this._ddlPrepended; }
|
|
295
357
|
|
|
296
358
|
// Sets the textbox value
|
|
297
359
|
setValue(value: string = "") {
|
|
@@ -38,6 +38,7 @@ export const InputGroupTypes: IInputGroupTypes;
|
|
|
38
38
|
|
|
39
39
|
import { IBaseProps } from "../types";
|
|
40
40
|
import { IButtonProps } from "../button/types";
|
|
41
|
+
import { IDropdown, IDropdownProps } from "../dropdown/types";
|
|
41
42
|
|
|
42
43
|
/** Input Group File Value */
|
|
43
44
|
export interface IInputGroupFileValue {
|
|
@@ -49,6 +50,9 @@ export interface IInputGroupFileValue {
|
|
|
49
50
|
* Input Group
|
|
50
51
|
*/
|
|
51
52
|
export interface IInputGroup {
|
|
53
|
+
/** Reference to the appended dropdown. */
|
|
54
|
+
appendedDropdown: IDropdown;
|
|
55
|
+
|
|
52
56
|
/** The input group element. */
|
|
53
57
|
el: HTMLElement;
|
|
54
58
|
|
|
@@ -64,6 +68,9 @@ export interface IInputGroup {
|
|
|
64
68
|
/** Hides the input group. */
|
|
65
69
|
hide: () => void;
|
|
66
70
|
|
|
71
|
+
/** Reference to the prepended dropdown. */
|
|
72
|
+
prependedDropdown: IDropdown;
|
|
73
|
+
|
|
67
74
|
/** Method to set the value. */
|
|
68
75
|
setValue: (value: string) => void;
|
|
69
76
|
|
|
@@ -76,6 +83,7 @@ export interface IInputGroup {
|
|
|
76
83
|
*/
|
|
77
84
|
export interface IInputGroupProps extends IBaseProps<IInputGroup> {
|
|
78
85
|
appendedButtons?: Array<IButtonProps>;
|
|
86
|
+
appendedDropdown?: IDropdownProps;
|
|
79
87
|
appendedLabel?: string;
|
|
80
88
|
formFl?: boolean;
|
|
81
89
|
id?: string;
|
|
@@ -90,6 +98,7 @@ export interface IInputGroupProps extends IBaseProps<IInputGroup> {
|
|
|
90
98
|
onChange?: (value?: string, ev?: Event) => void;
|
|
91
99
|
placeholder?: string;
|
|
92
100
|
prependedButtons?: Array<IButtonProps>;
|
|
101
|
+
prependedDropdown?: IDropdownProps;
|
|
93
102
|
prependedLabel?: string;
|
|
94
103
|
required?: boolean;
|
|
95
104
|
rows?: number;
|