gd-bs 6.1.0 → 6.1.2

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/index.html CHANGED
@@ -55,8 +55,12 @@
55
55
  window.addEventListener("load", function() {
56
56
  // Dev
57
57
  let items = [];
58
- for(var i=0; i<10; i++) {
59
- items.push({ label: "Item " + i, data: i, isSelected: true });
58
+ for (var i = 0; i < 10; i++) {
59
+ items.push({
60
+ label: "Item " + i,
61
+ data: i,
62
+ isSelected: true
63
+ });
60
64
  }
61
65
  window["form"] = GD.Components.Form({
62
66
  el: document.getElementById("dev"),
@@ -64,9 +68,20 @@
64
68
  name: "cb",
65
69
  label: "My CB",
66
70
  items,
67
- //renderRow: false,
68
- //colSize: 3,
71
+ renderRow: true,
72
+ colSize: 3,
69
73
  type: 8
74
+ }, {
75
+ name: "switch",
76
+ label: "Select an Option",
77
+ type: GD.Components.FormControlTypes.Switch,
78
+ items: [{
79
+ label: "Switch 1"
80
+ }, {
81
+ label: "Switch 2"
82
+ }, {
83
+ label: "Switch 3"
84
+ }]
70
85
  }]
71
86
  });
72
87
 
@@ -123,7 +138,9 @@
123
138
  text: "Test Tooltip",
124
139
  type: GD.Components.ButtonTypes.OutlineDanger
125
140
  },
126
- options: { trigger: "click" }
141
+ options: {
142
+ trigger: "click"
143
+ }
127
144
  });
128
145
 
129
146
  window["card"] = GD.Components.Card({
@@ -134,7 +151,9 @@
134
151
  actions: [{
135
152
  text: "Card Action",
136
153
  buttonType: GD.Components.ButtonTypes.OutlinePrimary,
137
- onClick: function(action, card) { alert(card.title + " was clicked."); }
154
+ onClick: function(action, card) {
155
+ alert(card.title + " was clicked.");
156
+ }
138
157
  }]
139
158
  }]
140
159
  });
@@ -862,6 +881,21 @@
862
881
  type: GD.Components.FormControlTypes.Password,
863
882
  }
864
883
  }]
884
+ }, {
885
+ columns: [{
886
+ control: {
887
+ label: "Select an Option",
888
+ name: "option",
889
+ type: GD.Components.FormControlTypes.Switch,
890
+ items: [{
891
+ label: "Switch 1"
892
+ }, {
893
+ label: "Switch 2"
894
+ }, {
895
+ label: "Switch 3"
896
+ }]
897
+ }
898
+ }]
865
899
  }, {
866
900
  columns: [{
867
901
  control: {
@@ -1103,7 +1137,9 @@
1103
1137
  tabContent: "This is the content for tab 4."
1104
1138
  }, {
1105
1139
  title: "NavTab 5",
1106
- onRenderTab: function(el) { el.innerHTML = "This is the content for tab 5." }
1140
+ onRenderTab: function(el) {
1141
+ el.innerHTML = "This is the content for tab 5."
1142
+ }
1107
1143
  }]
1108
1144
  });
1109
1145
  window["carousel"] = GD.Components.Carousel({
@@ -1183,7 +1219,9 @@
1183
1219
  GD.Components.Pagination({
1184
1220
  el: document.querySelector("#paging"),
1185
1221
  numberOfPages: 5,
1186
- onClick: function(pageNumber) { alert(pageNumber + " was clicked."); }
1222
+ onClick: function(pageNumber) {
1223
+ alert(pageNumber + " was clicked.");
1224
+ }
1187
1225
  });
1188
1226
  GD.Components.Progress({
1189
1227
  el: document.querySelector("#progress"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -35,7 +35,7 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
35
35
 
36
36
  // Configure the card group
37
37
  private configure(cbTemplate: string) {
38
- let renderRow = typeof (this.props.renderRow) === "boolean" ? this.props.renderRow : true;
38
+ let renderRow = typeof (this.props.colSize) === "number" ? this.props.colSize > 0 : false;
39
39
 
40
40
  // See if a label is defined
41
41
  let label = this.el.querySelector("legend");
@@ -37,14 +37,20 @@ export class CheckboxItem {
37
37
  if (this._elCheckbox) {
38
38
  this._elCheckbox.disabled = this._parent.isDisabled ? true : false;
39
39
  this._elCheckbox.readOnly = this._parent.isReadonly ? true : false;
40
+ this._elCheckbox.required = this._parent.required ? true : false;
40
41
 
41
42
  // Default the title property for the checkbox
42
43
  this._elCheckbox.title = this.props.label || this._parent.title || "";
43
44
  }
44
45
 
45
- // Set the column size
46
- let colSize = this._parent.colSize > 0 && this._parent.colSize < 13 ? this._parent.colSize : 12;
47
- this._el.classList.add("col-" + colSize);
46
+ // See if we are rendering a row
47
+ let renderRow = typeof (this._parent.colSize) === "number" ? this._parent.colSize > 0 : false;
48
+ if (renderRow) {
49
+ // Set the column size
50
+ let colSize = this._parent.colSize > 0 && this._parent.colSize < 13 ? this._parent.colSize : 12;
51
+ this._el.classList.add("col-" + colSize);
52
+
53
+ }
48
54
 
49
55
  // See if the title property is defined
50
56
  if (this._parent.title) {
@@ -95,7 +95,7 @@ export interface ICheckboxGroupProps extends IBaseProps<ICheckboxGroup> {
95
95
  multi?: boolean;
96
96
  onRender?: (el?: HTMLElement, item?: ICheckboxGroupItem) => void;
97
97
  onChange?: (items: ICheckboxGroupItem | Array<ICheckboxGroupItem>, ev?: Event) => void;
98
- renderRow?: boolean;
98
+ required?: boolean;
99
99
  title?: string;
100
100
  type?: number;
101
101
  value?: any;
@@ -289,6 +289,7 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
289
289
  dropdown.classList.add("form-select");
290
290
  dropdown.disabled = this.props.isReadonly ? true : false;
291
291
  dropdown.multiple = this.props.multi ? true : false;
292
+ dropdown.required = this.props.required ? true : false;
292
293
  this.props.title ? dropdown.title = this.props.title : null;
293
294
  }
294
295
  }
@@ -143,6 +143,7 @@ export interface IDropdownProps extends IBaseProps<IDropdown> {
143
143
  navFl?: boolean;
144
144
  onChange?: (item?: IDropdownItem | Array<IDropdownItem>, ev?: Event) => void;
145
145
  onMenuRendering?: (props: IPopoverProps) => IPopoverProps;
146
+ required?: boolean;
146
147
  setLabelToValue?: boolean;
147
148
  title?: string;
148
149
  type?: number;
@@ -121,7 +121,7 @@ export class FormControl implements IFormControl {
121
121
  isReadonly: this._props.isReadonly,
122
122
  items: cbProps.items,
123
123
  onChange: cbProps.onChange,
124
- renderRow: cbProps.renderRow,
124
+ required: this._props.required,
125
125
  title: this._props.title,
126
126
  type: CheckboxGroupTypes.Checkbox,
127
127
  value
@@ -137,6 +137,7 @@ export class FormControl implements IFormControl {
137
137
  isReadonly: this._props.isReadonly,
138
138
  onChange: (this._props as IFormControlPropsTextField).onChange,
139
139
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
140
+ required: this._props.required,
140
141
  title: this._props.title,
141
142
  type: InputGroupTypes.ColorPicker,
142
143
  value
@@ -153,6 +154,7 @@ export class FormControl implements IFormControl {
153
154
  isReadonly: this._props.isReadonly,
154
155
  items: (this._props as IFormControlPropsDropdown).items,
155
156
  onChange: (this._props as IFormControlPropsDropdown).onChange,
157
+ required: this._props.required,
156
158
  title: this._props.title,
157
159
  value
158
160
  });
@@ -168,6 +170,7 @@ export class FormControl implements IFormControl {
168
170
  items: (this._props as IFormControlPropsDropdown).items,
169
171
  onChange: (this._props as IFormControlPropsDropdown).onChange,
170
172
  onMenuRendering: (this._props as IFormControlPropsDropdown).onMenuRendering,
173
+ required: this._props.required,
171
174
  title: this._props.title,
172
175
  value
173
176
  });
@@ -182,6 +185,7 @@ export class FormControl implements IFormControl {
182
185
  isReadonly: this._props.isReadonly,
183
186
  onChange: (this._props as IFormControlPropsTextField).onChange,
184
187
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
188
+ required: this._props.required,
185
189
  title: this._props.title,
186
190
  type: InputGroupTypes.Email,
187
191
  value
@@ -197,6 +201,7 @@ export class FormControl implements IFormControl {
197
201
  isReadonly: this._props.isReadonly,
198
202
  onChange: (this._props as IFormControlPropsTextField).onChange,
199
203
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
204
+ required: this._props.required,
200
205
  title: this._props.title,
201
206
  type: InputGroupTypes.File,
202
207
  value
@@ -211,6 +216,7 @@ export class FormControl implements IFormControl {
211
216
  items: (this._props as IFormControlPropsListBox).items,
212
217
  onChange: (this._props as IFormControlPropsListBox).onChange,
213
218
  placeholder: (this._props as IFormControlPropsListBox).placeholder,
219
+ required: this._props.required,
214
220
  value
215
221
  });
216
222
  break;
@@ -229,7 +235,7 @@ export class FormControl implements IFormControl {
229
235
  items: cbMultiProps.items,
230
236
  multi: true,
231
237
  onChange: cbMultiProps.onChange,
232
- renderRow: cbMultiProps.renderRow,
238
+ required: this._props.required,
233
239
  title: this._props.title,
234
240
  type: CheckboxGroupTypes.Checkbox,
235
241
  value
@@ -247,6 +253,7 @@ export class FormControl implements IFormControl {
247
253
  multi: true,
248
254
  onChange: (this._props as IFormControlPropsDropdown).onChange,
249
255
  onMenuRendering: (this._props as IFormControlPropsDropdown).onMenuRendering,
256
+ required: this._props.required,
250
257
  title: this._props.title,
251
258
  value
252
259
  });
@@ -261,6 +268,7 @@ export class FormControl implements IFormControl {
261
268
  multi: true,
262
269
  onChange: (this._props as IFormControlPropsMultiListBox).onChange,
263
270
  placeholder: (this._props as IFormControlPropsMultiListBox).placeholder,
271
+ required: this._props.required,
264
272
  value
265
273
  });
266
274
  break;
@@ -276,7 +284,7 @@ export class FormControl implements IFormControl {
276
284
  items: (this._props as IFormControlPropsMultiCheckbox).items,
277
285
  multi: true,
278
286
  onChange: (this._props as IFormControlPropsMultiCheckbox).onChange,
279
- renderRow: (this._props as IFormControlPropsMultiCheckbox).renderRow,
287
+ required: this._props.required,
280
288
  title: this._props.title,
281
289
  type: CheckboxGroupTypes.Radio,
282
290
  value
@@ -294,7 +302,7 @@ export class FormControl implements IFormControl {
294
302
  items: (this._props as IFormControlPropsMultiCheckbox).items,
295
303
  multi: true,
296
304
  onChange: (this._props as IFormControlPropsMultiCheckbox).onChange,
297
- renderRow: (this._props as IFormControlPropsMultiCheckbox).renderRow,
305
+ required: this._props.required,
298
306
  title: this._props.title,
299
307
  type: CheckboxGroupTypes.Switch,
300
308
  value
@@ -310,6 +318,7 @@ export class FormControl implements IFormControl {
310
318
  isReadonly: this._props.isReadonly,
311
319
  onChange: (this._props as IFormControlPropsTextField).onChange,
312
320
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
321
+ required: this._props.required,
313
322
  title: this._props.title,
314
323
  type: InputGroupTypes.Password,
315
324
  value
@@ -326,7 +335,7 @@ export class FormControl implements IFormControl {
326
335
  isReadonly: this._props.isReadonly,
327
336
  items: (this._props as IFormControlPropsCheckbox).items,
328
337
  onChange: (this._props as IFormControlPropsCheckbox).onChange,
329
- renderRow: (this._props as IFormControlPropsCheckbox).renderRow,
338
+ required: this._props.required,
330
339
  title: this._props.title,
331
340
  type: CheckboxGroupTypes.Radio,
332
341
  value
@@ -344,6 +353,7 @@ export class FormControl implements IFormControl {
344
353
  max: (this._props as IFormControlPropsRange).max || 100,
345
354
  onChange: (this._props as IFormControlPropsRange).onChange,
346
355
  placeholder: (this._props as IFormControlPropsRange).placeholder,
356
+ required: this._props.required,
347
357
  step: (this._props as IFormControlPropsRange).step,
348
358
  title: this._props.title,
349
359
  type: InputGroupTypes.Range,
@@ -359,6 +369,7 @@ export class FormControl implements IFormControl {
359
369
  isReadonly: true,
360
370
  onChange: (this._props as IFormControlPropsTextField).onChange,
361
371
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
372
+ required: this._props.required,
362
373
  title: this._props.title,
363
374
  type: InputGroupTypes.TextField,
364
375
  value
@@ -375,7 +386,7 @@ export class FormControl implements IFormControl {
375
386
  isReadonly: this._props.isReadonly,
376
387
  items: (this._props as IFormControlPropsCheckbox).items,
377
388
  onChange: (this._props as IFormControlPropsCheckbox).onChange,
378
- renderRow: (this._props as IFormControlPropsCheckbox).renderRow,
389
+ required: this._props.required,
379
390
  title: this._props.title,
380
391
  type: CheckboxGroupTypes.Switch,
381
392
  value
@@ -391,6 +402,7 @@ export class FormControl implements IFormControl {
391
402
  isReadonly: this._props.isReadonly,
392
403
  onChange: (this._props as IFormControlPropsTextField).onChange,
393
404
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
405
+ required: this._props.required,
394
406
  rows: (this._props as IFormControlPropsTextField).rows,
395
407
  title: this._props.title,
396
408
  type: InputGroupTypes.TextArea,
@@ -407,6 +419,7 @@ export class FormControl implements IFormControl {
407
419
  isReadonly: this._props.isReadonly,
408
420
  onChange: (this._props as IFormControlPropsTextField).onChange,
409
421
  placeholder: (this._props as IFormControlPropsTextField).placeholder,
422
+ required: this._props.required,
410
423
  title: this._props.title,
411
424
  type: InputGroupTypes.TextField,
412
425
  value
@@ -105,7 +105,6 @@ export interface IFormControlPropsCheckbox extends IFormControlProps {
105
105
  onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
106
106
  onGetValue?: (control: IFormControlPropsCheckbox) => any;
107
107
  onValidate?: (control: IFormControlPropsCheckbox, value: IFormControlValidationResult) => boolean | IFormControlValidationResult;
108
- renderRow?: boolean;
109
108
  }
110
109
 
111
110
  /**
@@ -219,6 +219,7 @@ class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
219
219
  this.props.placeholder ? textarea.placeholder = this.props.placeholder : null;
220
220
  textarea.disabled = this.props.isDisabled ? true : false;
221
221
  textarea.readOnly = this.props.isReadonly ? true : false;
222
+ textarea.required = this.props.required ? true : false;
222
223
  textarea.rows = this.props.rows;
223
224
  this.props.title ? textarea.title = this.props.title : null;
224
225
  }
@@ -233,6 +234,7 @@ class _InputGroup extends Base<IInputGroupProps> implements IInputGroup {
233
234
  this.props.placeholder ? input.placeholder = this.props.placeholder : null;
234
235
  input.disabled = this.props.isDisabled ? true : false;
235
236
  input.readOnly = this.props.isReadonly ? true : false;
237
+ input.required = this.props.required ? true : false;
236
238
  this.props.title ? input.title = this.props.title : null;
237
239
  typeof (this.props.min) === "number" ? input.min = this.props.min + "" : null;
238
240
  typeof (this.props.max) === "number" ? input.max = this.props.max + "" : null;
@@ -91,6 +91,7 @@ export interface IInputGroupProps extends IBaseProps<IInputGroup> {
91
91
  placeholder?: string;
92
92
  prependedButtons?: Array<IButtonProps>;
93
93
  prependedLabel?: string;
94
+ required?: boolean;
94
95
  rows?: number;
95
96
  step?: number;
96
97
  title?: string;
@@ -72,6 +72,9 @@ class _ListBox extends Base<IListBoxProps> implements IListBox {
72
72
  this._elSearchBox ? this._elSearchBox.disabled = true : null;
73
73
  }
74
74
 
75
+ // Set the required property
76
+ this._elSearchBox.required = this.props.required ? true : false;
77
+
75
78
  // Set the options
76
79
  this.setOptions(this.props.items);
77
80
 
@@ -99,8 +99,9 @@ export interface IListBoxProps extends IBaseProps<IListBox> {
99
99
  isReadonly?: boolean;
100
100
  items: Array<IDropdownItem>;
101
101
  multi?: boolean;
102
- placeholder?: string;
103
102
  onLoadData?: () => Array<IDropdownItem> | PromiseLike<Array<IDropdownItem>>;
104
103
  onChange?: (items: IDropdownItem | Array<IDropdownItem>, ev?: Event) => void;
104
+ placeholder?: string;
105
+ required?: boolean;
105
106
  value?: string | Array<string>;
106
107
  }