gd-bs 5.7.6 → 5.7.9

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
@@ -64,6 +64,8 @@
64
64
  name: "cb",
65
65
  label: "My CB",
66
66
  items,
67
+ //renderRow: false,
68
+ //colSize: 3,
67
69
  type: 8
68
70
  }]
69
71
  });
@@ -976,7 +978,8 @@
976
978
  id: "offcanvas-demo",
977
979
  title: "Offcanvas Demo",
978
980
  body: "<h5>Hello Canvas</h5><input />",
979
- type: 2,
981
+ size: 5,
982
+ type: 3,
980
983
  options: {
981
984
  backdrop: true
982
985
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "5.7.6",
3
+ "version": "5.7.9",
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 @@
35
35
  "dependencies": {
36
36
  "@popperjs/core": "^2.11.5",
37
37
  "bootstrap": "^5.1.3",
38
- "bootstrap-icons": "^1.8.2",
38
+ "bootstrap-icons": "^1.9.1",
39
39
  "core-js": "^3.22.6",
40
40
  "tippy.js": "^6.3.7"
41
41
  },
package/pnpm-lock.yaml CHANGED
@@ -3307,7 +3307,7 @@ specifiers:
3307
3307
  autoprefixer: ^10.4.7
3308
3308
  babel-loader: ^8.2.5
3309
3309
  bootstrap: ^5.1.3
3310
- bootstrap-icons: ^1.8.2
3310
+ bootstrap-icons: ^1.9.1
3311
3311
  core-js: ^3.22.6
3312
3312
  css-loader: ^6.7.1
3313
3313
  dts-bundle: ^0.7.3
package/src/bs.scss CHANGED
@@ -339,6 +339,36 @@
339
339
  margin: 0rem 0rem 0rem auto;
340
340
  padding: 1rem;
341
341
  }
342
+ /* Off-canvas sizes (Small 1) */
343
+ .offcanvas-start.offcanvas-size-sm1, .offcanvas-end.offcanvas-size-sm1 { width: 20vw; }
344
+ .offcanvas-top.offcanvas-size-sm1, .offcanvas-bottom.offcanvas-size-sm1 { height: 20vh; }
345
+ /* Off-canvas sizes (Small 2) */
346
+ .offcanvas-start.offcanvas-size-sm2, .offcanvas-end.offcanvas-size-sm2 { width: 25vw; }
347
+ .offcanvas-top.offcanvas-size-sm2, .offcanvas-bottom.offcanvas-size-sm2 { height: 25vh; }
348
+ /* Off-canvas sizes (Small 3) */
349
+ .offcanvas-start.offcanvas-size-sm3, .offcanvas-end.offcanvas-size-sm3 { width: 30vw; }
350
+ .offcanvas-top.offcanvas-size-sm3, .offcanvas-bottom.offcanvas-size-sm3 { height: 30vh; }
351
+ /* Off-canvas sizes (Medium 1) */
352
+ .offcanvas-start.offcanvas-size-md1, .offcanvas-end.offcanvas-size-md1 { width: 40vw; }
353
+ .offcanvas-top.offcanvas-size-md1, .offcanvas-bottom.offcanvas-size-md1 { height: 40vh; }
354
+ /* Off-canvas sizes (Medium 2) */
355
+ .offcanvas-start.offcanvas-size-md2, .offcanvas-end.offcanvas-size-md2 { width: 50vw; }
356
+ .offcanvas-top.offcanvas-size-md2, .offcanvas-bottom.offcanvas-size-md2 { height: 50vh; }
357
+ /* Off-canvas sizes (Medium 3) */
358
+ .offcanvas-start.offcanvas-size-md3, .offcanvas-end.offcanvas-size-md3 { width: 60vw; }
359
+ .offcanvas-top.offcanvas-size-md3, .offcanvas-bottom.offcanvas-size-md3 { height: 60vh; }
360
+ /* Off-canvas sizes (Large 1) */
361
+ .offcanvas-start.offcanvas-size-lg1, .offcanvas-end.offcanvas-size-lg1 { width: 75vw; }
362
+ .offcanvas-top.offcanvas-size-lg1, .offcanvas-bottom.offcanvas-size-lg1 { height: 75vh; }
363
+ /* Off-canvas sizes (Large 2) */
364
+ .offcanvas-start.offcanvas-size-lg2, .offcanvas-end.offcanvas-size-lg2 { width: 80vw; }
365
+ .offcanvas-top.offcanvas-size-lg2, .offcanvas-bottom.offcanvas-size-lg2 { height: 80vh; }
366
+ /* Off-canvas sizes (Large 3) */
367
+ .offcanvas-start.offcanvas-size-lg3, .offcanvas-end.offcanvas-size-lg3 { width: 90vw; }
368
+ .offcanvas-top.offcanvas-size-lg3, .offcanvas-bottom.offcanvas-size-lg3 { height: 90vh; }
369
+ /* Off-canvas sizes (Full) */
370
+ .offcanvas-start.offcanvas-size-full, .offcanvas-end.offcanvas-size-full { width: 100vw; }
371
+ .offcanvas-top.offcanvas-size-full, .offcanvas-bottom.offcanvas-size-full { height: 100vh; }
342
372
  /* Color match the pagination link color to 'SharePoint Blue' */
343
373
  .page-link {
344
374
  border-color: #6c757d;
@@ -35,21 +35,13 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
35
35
 
36
36
  // Configure the card group
37
37
  private configure(cbTemplate: string) {
38
- let colSize = this.props.colSize > 0 && this.props.colSize < 13 ? this.props.colSize : (this.props.label ? 10 : 12);
39
38
  let renderRow = typeof (this.props.renderRow) === "boolean" ? this.props.renderRow : true;
40
39
 
41
- // See if we are not rendering a row
42
- if (!renderRow) {
43
- // Remove the row class
44
- this.el.classList.remove("row");
45
- }
46
-
47
40
  // See if a label is defined
48
41
  let label = this.el.querySelector("legend");
49
42
  if (label) {
50
43
  if (this.props.label && this.props.hideLabel != true) {
51
44
  // Add the label
52
- renderRow ? label.classList.add("col-" + (12 - colSize)) : null;
53
45
  label.innerHTML = this.props.label;
54
46
  } else {
55
47
  // Remove the label
@@ -60,10 +52,7 @@ class _CheckboxGroup extends Base<ICheckboxGroupProps> implements ICheckboxGroup
60
52
  // Get the group and configure the size
61
53
  let group = this.el.querySelector("div");
62
54
  if (group) {
63
- if (renderRow) {
64
- // Set the class
65
- group.classList.add("col-" + colSize);
66
- } else {
55
+ if (!renderRow) {
67
56
  // Remove the group element
68
57
  this.el.removeChild(group);
69
58
  }
@@ -42,6 +42,10 @@ export class CheckboxItem {
42
42
  this._elCheckbox.title = this.props.label || this._parent.title || "";
43
43
  }
44
44
 
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);
48
+
45
49
  // See if the title property is defined
46
50
  if (this._parent.title) {
47
51
  // Set the title
@@ -1,8 +1,8 @@
1
1
  // Checkbox
2
2
  export const HTML = `
3
- <div class="row">
3
+ <div>
4
4
  <legend class="col-form-label"></legend>
5
- <div></div>
5
+ <div class="row"></div>
6
6
  </div>`.trim();
7
7
 
8
8
  // Checkbox
@@ -117,6 +117,7 @@ export class FormControl implements IFormControl {
117
117
  isReadonly: this._props.isReadonly,
118
118
  items: cbProps.items,
119
119
  onChange: cbProps.onChange,
120
+ renderRow: cbProps.renderRow,
120
121
  title: this._props.title,
121
122
  type: CheckboxGroupTypes.Checkbox,
122
123
  value: this._props.value
@@ -224,6 +225,7 @@ export class FormControl implements IFormControl {
224
225
  items: cbMultiProps.items,
225
226
  multi: true,
226
227
  onChange: cbMultiProps.onChange,
228
+ renderRow: cbMultiProps.renderRow,
227
229
  title: this._props.title,
228
230
  type: CheckboxGroupTypes.Checkbox,
229
231
  value: this._props.value
@@ -270,6 +272,7 @@ export class FormControl implements IFormControl {
270
272
  items: (this._props as IFormControlPropsMultiCheckbox).items,
271
273
  multi: true,
272
274
  onChange: (this._props as IFormControlPropsMultiCheckbox).onChange,
275
+ renderRow: (this._props as IFormControlPropsMultiCheckbox).renderRow,
273
276
  title: this._props.title,
274
277
  type: CheckboxGroupTypes.Radio,
275
278
  value: this._props.value
@@ -287,6 +290,7 @@ export class FormControl implements IFormControl {
287
290
  items: (this._props as IFormControlPropsMultiCheckbox).items,
288
291
  multi: true,
289
292
  onChange: (this._props as IFormControlPropsMultiCheckbox).onChange,
293
+ renderRow: (this._props as IFormControlPropsMultiCheckbox).renderRow,
290
294
  title: this._props.title,
291
295
  type: CheckboxGroupTypes.Switch,
292
296
  value: this._props.value
@@ -318,6 +322,7 @@ export class FormControl implements IFormControl {
318
322
  isReadonly: this._props.isReadonly,
319
323
  items: (this._props as IFormControlPropsCheckbox).items,
320
324
  onChange: (this._props as IFormControlPropsCheckbox).onChange,
325
+ renderRow: (this._props as IFormControlPropsCheckbox).renderRow,
321
326
  title: this._props.title,
322
327
  type: CheckboxGroupTypes.Radio,
323
328
  value: this._props.value
@@ -366,6 +371,7 @@ export class FormControl implements IFormControl {
366
371
  isReadonly: this._props.isReadonly,
367
372
  items: (this._props as IFormControlPropsCheckbox).items,
368
373
  onChange: (this._props as IFormControlPropsCheckbox).onChange,
374
+ renderRow: (this._props as IFormControlPropsCheckbox).renderRow,
369
375
  title: this._props.title,
370
376
  type: CheckboxGroupTypes.Switch,
371
377
  value: this._props.value
@@ -103,6 +103,7 @@ export interface IFormControlPropsCheckbox extends IFormControlProps {
103
103
  onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
104
104
  onGetValue?: (control: IFormControlPropsCheckbox) => any;
105
105
  onValidate?: (control: IFormControlPropsCheckbox, value: IFormControlValidationResult) => boolean | IFormControlValidationResult;
106
+ renderRow?: boolean;
106
107
  }
107
108
 
108
109
  /**
@@ -142,6 +143,7 @@ export interface IFormControlPropsMultiCheckbox extends IFormControlProps {
142
143
  onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
143
144
  onGetValue?: (control: IFormControlPropsCheckbox) => any;
144
145
  onValidate?: (control: IFormControlPropsCheckbox, value: IFormControlValidationResult) => boolean | IFormControlValidationResult;
146
+ renderRow?: boolean;
145
147
  }
146
148
 
147
149
  /**
@@ -4,22 +4,57 @@ import { Base } from "../base";
4
4
  import { appendContent } from "../common";
5
5
  import { HTML } from "./templates";
6
6
 
7
+
8
+ /**
9
+ * Offcanvas Size
10
+ */
11
+ export enum OffcanvasSize {
12
+ Small1 = 1,
13
+ Small2 = 2,
14
+ Small3 = 3,
15
+ Medium1 = 4,
16
+ Medium2 = 5,
17
+ Medium3 = 6,
18
+ Large1 = 7,
19
+ Large2 = 8,
20
+ Large3 = 9,
21
+ Full = 10
22
+ }
23
+
24
+ /**
25
+ * Offcanvas Size Classes
26
+ */
27
+ export const OffcanvasSizeClassNames = new ClassNames([
28
+ "offcanvas-size-sm1",
29
+ "offcanvas-size-sm2",
30
+ "offcanvas-size-sm3",
31
+ "offcanvas-size-md1",
32
+ "offcanvas-size-md2",
33
+ "offcanvas-size-md3",
34
+ "offcanvas-size-lg1",
35
+ "offcanvas-size-lg2",
36
+ "offcanvas-size-lg3",
37
+ "offcanvas-size-full"
38
+ ]);
39
+
7
40
  /**
8
41
  * Offcanvas Types
9
42
  */
10
43
  export enum OffcanvasTypes {
11
44
  Bottom = 1,
12
45
  End = 2,
13
- Start = 3
46
+ Start = 3,
47
+ Top = 4
14
48
  }
15
49
 
16
50
  /**
17
- * Offcanvas Classes
51
+ * Offcanvas Types Classes
18
52
  */
19
- export const OffcanvasClassNames = new ClassNames([
53
+ export const OffcanvasTypesClassNames = new ClassNames([
20
54
  "offcanvas-bottom",
21
55
  "offcanvas-end",
22
- "offcanvas-start"
56
+ "offcanvas-start",
57
+ "offcanvas-top"
23
58
  ]);
24
59
 
25
60
  /**
@@ -49,7 +84,8 @@ class _Offcanvas extends Base<IOffcanvasProps> implements IOffcanvas {
49
84
  // Set the attributes
50
85
  this.props.id ? this.el.id = this.props.id : null;
51
86
 
52
- // Set the type
87
+ // Set the size & type
88
+ this.setSize(this.props.size);
53
89
  this.setType(this.props.type);
54
90
 
55
91
  // Get the options
@@ -174,16 +210,29 @@ class _Offcanvas extends Base<IOffcanvasProps> implements IOffcanvas {
174
210
  this._autoClose ? this.configureAutoCloseEvent() : null;
175
211
  }
176
212
 
213
+ // Sets the offcanvas size
214
+ setSize(offcanvasSize: number) {
215
+ // Parse the class names
216
+ OffcanvasSizeClassNames.parse(className => {
217
+ // Remove the class names
218
+ this.el.classList.remove(className);
219
+ });
220
+
221
+ // Set the class name
222
+ let className = OffcanvasSizeClassNames.getByType(offcanvasSize);
223
+ if (className) { this.el.classList.add(className); }
224
+ }
225
+
177
226
  // Sets the offcanvas type
178
227
  setType(offcanvasType: number) {
179
228
  // Parse the class names
180
- OffcanvasClassNames.parse(className => {
229
+ OffcanvasTypesClassNames.parse(className => {
181
230
  // Remove the class names
182
231
  this.el.classList.remove(className);
183
232
  });
184
233
 
185
234
  // Set the class name
186
- let className = OffcanvasClassNames.getByType(offcanvasType) || OffcanvasClassNames.getByType(OffcanvasTypes.End);
235
+ let className = OffcanvasTypesClassNames.getByType(offcanvasType) || OffcanvasTypesClassNames.getByType(OffcanvasTypes.End);
187
236
  this.el.classList.add(className);
188
237
  }
189
238
 
@@ -88,6 +88,9 @@ export interface IOffcanvas {
88
88
  /** Updates the auto close flag. */
89
89
  setAutoClose: (value: boolean) => void;
90
90
 
91
+ /** Updates the size. */
92
+ setSize: (canvasSize: number) => void;
93
+
91
94
  /** Updates the type. */
92
95
  setType: (canvasType: number) => void;
93
96
 
@@ -108,6 +111,7 @@ export interface IOffcanvasProps<T = Element> extends IBaseProps<IOffcanvas> {
108
111
  onRenderBody?: (el?: HTMLDivElement, props?: IOffcanvasProps) => void;
109
112
  onRenderHeader?: (el?: HTMLDivElement, props?: IOffcanvasProps) => void;
110
113
  options?: IOffcanvasOptions;
114
+ size?: number;
111
115
  title?: string | T;
112
116
  type?: number;
113
117
  }
@@ -135,6 +139,22 @@ export interface IOffcanvasOptions {
135
139
  visible?: boolean;
136
140
  }
137
141
 
142
+ /**
143
+ * Offcanvas Size
144
+ */
145
+ export type IOffcanvasSize = {
146
+ Small1: number;
147
+ Small2: number;
148
+ Small3: number;
149
+ Medium1: number;
150
+ Medium2: number;
151
+ Medium3: number;
152
+ Large1: number;
153
+ Large2: number;
154
+ Large3: number;
155
+ Full: number;
156
+ }
157
+
138
158
  /**
139
159
  * Offcanvas Types
140
160
  */
@@ -142,4 +162,5 @@ export type IOffcanvasTypes = {
142
162
  Bottom: number;
143
163
  End: number;
144
164
  Start: number;
165
+ Top: number;
145
166
  }