inviton-powerduck 0.0.222 → 0.0.224

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.
@@ -10,6 +10,7 @@ import './css/checkbox.css';
10
10
  interface CheckBoxArgs extends FormItemWrapperArgs {
11
11
  value: boolean;
12
12
  checkboxLabelHtml?: string;
13
+ customRenderOption?: (h, state: CheckBoxDisplayArgs) => any;
13
14
  skin?: CheckBoxSkin;
14
15
  size?: CheckBoxSize;
15
16
  disabled?: boolean;
@@ -27,6 +28,11 @@ export enum CheckBoxSize {
27
28
  Medium = 'md',
28
29
  }
29
30
 
31
+ interface CheckBoxDisplayArgs {
32
+ checked: boolean;
33
+ disabled: boolean;
34
+ }
35
+
30
36
  @Component
31
37
  class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxArgs {
32
38
  @Prop() label!: string;
@@ -34,6 +40,7 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
34
40
  @Prop() cssClass!: string;
35
41
  @Prop() subtitle!: string;
36
42
  @Prop() checkboxLabelHtml!: string;
43
+ @Prop() customRenderOption?: (h, state: CheckBoxDisplayArgs) => any;
37
44
  @Prop() value!: boolean;
38
45
  @Prop() mandatory!: boolean;
39
46
  @Prop() wrap!: boolean;
@@ -50,6 +57,19 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
50
57
  @Prop() changed: (newValue: boolean) => void;
51
58
  uuid: string = null;
52
59
 
60
+ getCustomRenderedLabel(h) {
61
+ if (this.customRenderOption != null) {
62
+ const displayArgs: CheckBoxDisplayArgs = {
63
+ checked: this.value,
64
+ disabled: this.disabled ?? false,
65
+ };
66
+
67
+ return this.customRenderOption(h, displayArgs);
68
+ }
69
+
70
+ return null;
71
+ }
72
+
53
73
  raiseChangeEvent(e) {
54
74
  this.populateValidationDeclaration();
55
75
  const val = e.target.checked;
@@ -102,7 +122,7 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
102
122
  <label class="form-check-label">
103
123
  <input class="form-check-input" type="checkbox" checked={this.value} disabled={this.disabled || undefined} onChange={e => this.raiseChangeEvent(e)} />
104
124
  <span class="form-check-sign"></span>
105
- {this.checkboxLabelHtml}
125
+ {this.getCustomRenderedLabel != null ? this.getCustomRenderedLabel(h) : this.checkboxLabelHtml}
106
126
  </label>
107
127
  </div>
108
128
  );
@@ -120,7 +140,7 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
120
140
  <div class="inv-cbrb-inner">
121
141
  <input class="inv-chckb-clickable" type="checkbox" id={`iei-input-${this.uuid}`} checked={this.value} disabled={this.disabled || undefined} onChange={e => this.raiseChangeEvent(e)} />
122
142
  <label class="inv-chckb-clickable form-check-label " for={`iei-input-${this.uuid}`}>
123
- <HtmlLiteral innerHTML={this.checkboxLabelHtml} />
143
+ {this.getCustomRenderedLabel != null ? this.getCustomRenderedLabel(h) : <HtmlLiteral innerHTML={this.checkboxLabelHtml} />}
124
144
  </label>
125
145
  </div>
126
146
  </div>
@@ -140,7 +160,7 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
140
160
  <div class="inv-cbrb-inner">
141
161
  <input class="inv-chckb-clickable" type="checkbox" id={`iei-input-${this.uuid}`} checked={this.value} disabled={this.disabled || undefined} onChange={e => this.raiseChangeEvent(e)} />
142
162
  <label class="inv-chckb-clickable form-check-label " for={`iei-input-${this.uuid}`}>
143
- <HtmlLiteral innerHTML={this.checkboxLabelHtml} />
163
+ {this.getCustomRenderedLabel != null ? this.getCustomRenderedLabel(h) : <HtmlLiteral innerHTML={this.checkboxLabelHtml} />}
144
164
  </label>
145
165
  </div>
146
166
  </div>
@@ -265,7 +265,7 @@ import { globalState } from '../../../../app/global-state';
265
265
  // 1970 01 01 bol štvrtok. Pre weekday v rozsahu 0..6 kde 0 nedeľa:
266
266
  const weekdayFromEpochDay = (epochDay: number) => (epochDay + 4) % 7; // 0 št 1 pia 2 so 3 ne 4 po 5 ut 6 st
267
267
  // ak chceš 0 nedeľa:
268
- const weekdaySun0 = (epochDay: number) => (epochDay + 4 + 3) % 7; // posun na nedeľu
268
+ const weekdaySun0 = (epochDay: number) => (epochDay + 4) % 7; // posun na nedeľu
269
269
 
270
270
  const toEpochDayUTC = (msUTC: number) => Math.floor(msUTC / MS_PER_DAY);
271
271
  const fromEpochDayUTC = (epochDay: number) => epochDay * MS_PER_DAY;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.222",
4
+ "version": "0.0.224",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",