inviton-powerduck 0.0.104 → 0.0.106

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.
@@ -1,6 +1,6 @@
1
1
  import { toNative, Prop } from "vue-facing-decorator";
2
2
  import TsxComponent, { Component } from "../../app/vuetsx";
3
- import DataTable, { TableColumn, RowIndexMode, DataTableFilterMode, DataTableOnSortedArgs } from "./datatable";
3
+ import DataTable, { TableColumn, RowIndexMode, DataTableFilterMode, DataTableOnSortedArgs, DataTableMobileBehavior } from "./datatable";
4
4
  import { IWebApiClient, WebClientApiMethod } from "../../common/IWebClient";
5
5
 
6
6
  interface DataTableStaticArgs {
@@ -19,6 +19,7 @@ interface DataTableStaticArgs {
19
19
  preserveFilter?: boolean
20
20
  checkboxButtonsVisible?: boolean;
21
21
  sortableRows?: boolean;
22
+ mobileBehavior?: DataTableMobileBehavior;
22
23
  rowCheckstateChanged?: (row: any, checked: boolean, selectedRows: any[]) => void;
23
24
  sortComplete?: (args: DataTableOnSortedArgs) => void;
24
25
  }
@@ -41,6 +42,7 @@ export class DataTableStaticComponent extends TsxComponent<DataTableStaticArgs>
41
42
  @Prop() checkboxesTitle!: string;
42
43
  @Prop() checkboxButtonsVisible!: boolean;
43
44
  @Prop() sortableRows!: boolean;
45
+ @Prop() mobileBehavior!: DataTableMobileBehavior;
44
46
  @Prop() rowCheckstateChanged?: (row: any, checked: boolean, selectedRows: any[]) => void;
45
47
  @Prop() sortComplete?: (args: DataTableOnSortedArgs) => void;
46
48
 
@@ -119,6 +121,7 @@ export class DataTableStaticComponent extends TsxComponent<DataTableStaticArgs>
119
121
  sortComplete={this.sortComplete}
120
122
  preserveOrderBy={this.preserveOrderBy}
121
123
  fullSizeHasButtonBelow={this.fullSizeTable}
124
+ mobileBehavior={this.mobileBehavior}
122
125
  />
123
126
  );
124
127
  }
@@ -1,4 +1,4 @@
1
- import { toNative, Prop, Watch } from "vue-facing-decorator";
1
+ import { toNative, Prop } from "vue-facing-decorator";
2
2
  import TsxComponent, { Component } from "../../app/vuetsx";
3
3
  import FormItemWrapper, { FormItemWrapperArgs, MarginType } from "../form/form-item-wrapper";
4
4
  import HtmlLiteral from "../html-literal/html-literal";
@@ -9,13 +9,20 @@ interface CheckBoxArgs extends FormItemWrapperArgs {
9
9
  value: boolean;
10
10
  checkboxLabelHtml?: string;
11
11
  skin?: CheckBoxSkin;
12
+ size?: CheckBoxSize;
12
13
  disabled?: boolean;
13
14
  changed?: (newValue: boolean) => void;
14
15
  }
15
16
 
16
17
  export enum CheckBoxSkin {
17
18
  NowUi = 0,
18
- Material = 1,
19
+ Material = 1, // default
20
+ MinusVariant = 2,
21
+ }
22
+
23
+ export enum CheckBoxSize {
24
+ Small = "sm",
25
+ Medium = "md",
19
26
  }
20
27
 
21
28
  @Component
@@ -30,6 +37,7 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
30
37
  @Prop() wrap!: boolean;
31
38
  @Prop() maxWidth?: number;
32
39
  @Prop() skin!: CheckBoxSkin;
40
+ @Prop() size?: CheckBoxSize;
33
41
  @Prop() disabled?: boolean;
34
42
  @Prop() marginType?: MarginType;
35
43
  @Prop() hint: string;
@@ -75,14 +83,20 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
75
83
  renderCheckboxBasedOnSkin(h) {
76
84
  if (this.skin == CheckBoxSkin.NowUi) {
77
85
  return this.renderCheckboxNowUi(h);
78
- } else {
79
- return this.renderCheckboxMaterial(h);
86
+ } else if (this.skin == CheckBoxSkin.MinusVariant) {
87
+ return this.renderCheckboxMaterialMinus(h);
80
88
  }
89
+ // default -> CheckBoxSkin.Material
90
+ return this.renderCheckboxMaterial(h);
81
91
  }
82
92
 
83
93
  renderCheckboxNowUi(h) {
94
+ const checkboxClass = "form-check " +
95
+ (this.wrap ? "ui-checkbox-wrapped" : "ui-checkbox-nonwrapped") +
96
+ (this.size === CheckBoxSize.Small ? " ui-checkbox-sm" : "");
97
+
84
98
  return (
85
- <div class={"form-check " + (this.wrap ? "ui-checkbox-wrapped" : "ui-checkbox-nonwrapped")}>
99
+ <div class={checkboxClass}>
86
100
  <label class="form-check-label">
87
101
  <input class="form-check-input" type="checkbox" checked={this.value} disabled={this.disabled || undefined} onChange={(e) => this.raiseChangeEvent(e)} />
88
102
  <span class="form-check-sign"></span>
@@ -97,8 +111,32 @@ class CheckBoxComponent extends TsxComponent<CheckBoxArgs> implements CheckBoxAr
97
111
  this.uuid = PortalUtils.randomString(12);
98
112
  }
99
113
 
114
+ const checkboxClass = "inv-md-checkbox" +
115
+ (this.size === CheckBoxSize.Small ? " inv-md-checkbox-sm" : "");
116
+
117
+ return (
118
+ <div class={checkboxClass}>
119
+ <div class="inv-cbrb-inner">
120
+ <input class="inv-chckb-clickable" type="checkbox" id={"iei-input-" + this.uuid} checked={this.value} disabled={this.disabled || undefined} onChange={(e) => this.raiseChangeEvent(e)} />
121
+ <label class="inv-chckb-clickable form-check-label " for={"iei-input-" + this.uuid}>
122
+ <HtmlLiteral innerHTML={this.checkboxLabelHtml} />
123
+ </label>
124
+ </div>
125
+ </div>
126
+ );
127
+ }
128
+
129
+ renderCheckboxMaterialMinus(h) {
130
+ if (this.uuid == null) {
131
+ this.uuid = PortalUtils.randomString(12);
132
+ }
133
+
134
+ const checkboxClass = "inv-md-checkbox" +
135
+ (this.size === CheckBoxSize.Small ? " inv-md-checkbox-sm" : "") +
136
+ (this.skin === CheckBoxSkin.MinusVariant ? " inv-md-checkbox-minus" : "");
137
+
100
138
  return (
101
- <div class="inv-md-checkbox">
139
+ <div class={checkboxClass}>
102
140
  <div class="inv-cbrb-inner">
103
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)} />
104
142
  <label class="inv-chckb-clickable form-check-label " for={"iei-input-" + this.uuid}>
@@ -16,6 +16,12 @@ interface RadioButtonGroupArgs extends FormItemWrapperArgs {
16
16
  displayMember?: string | RowToString;
17
17
  valueMember?: string | RowToString;
18
18
  selected: string | any;
19
+ radioButtonSize?: RadioButtonSize;
20
+ }
21
+
22
+ export const enum RadioButtonSize {
23
+ Small = 'sm',
24
+ Medium = 'md'
19
25
  }
20
26
 
21
27
  interface RadioDisplayArgs {
@@ -38,6 +44,7 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
38
44
  @Prop() prependIcon: string
39
45
  @Prop() appendClicked: () => void
40
46
  @Prop() prependClicked: () => void
47
+ @Prop() radioButtonSize?: RadioButtonSize;
41
48
  @Prop() marginType?: MarginType
42
49
  @Prop() maxWidth?: number
43
50
  @Prop() options!: Array<string> | Array<any>;
@@ -193,31 +200,48 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
193
200
  }
194
201
 
195
202
  renderInput(h) {
196
- let nameId = 'iei-group-' + PortalUtils.randomString(6);
197
- let selectedItem = this.getSelectedItem();
198
-
199
- return (
200
- <div class="radio-group-wrap">
201
- {this.getOptions().map((optionItem) => {
202
- const uuid = 'iei-input-' + PortalUtils.randomString(10);
203
- const selected = optionItem.id == selectedItem?.id;
204
- const disabled = optionItem.dataRow?.dataRow?.disabled ?? false;
205
-
206
- return (
207
- <div class="inv-rbchb form-check inv-mdfw-radio">
208
- <div class="inv-cbrb-inner">
209
- <input class="form-check-input" key={uuid} checked={selected} type="radio" name={nameId} id={uuid} value={optionItem.id} disabled={disabled} onChange={() => this.handleRadioValueChanged()} />
210
- <label class="form-check-label" for={uuid}>
211
- {/* <span>{optionItem.text}</span> */}
212
- <HtmlLiteral innerHTML={optionItem.text} />
213
- </label>
214
- </div>
215
- </div>
216
- )
217
- })}
218
- </div>
219
- )
220
- }
203
+ const nameId = 'iei-group-' + PortalUtils.randomString(6);
204
+ const selectedItem = this.getSelectedItem();
205
+ const isSmall = this.radioButtonSize === RadioButtonSize.Small;
206
+
207
+ return (
208
+ <div class="radio-group-wrap">
209
+ {this.getOptions().map((optionItem) => {
210
+ const uuid = 'iei-input-' + PortalUtils.randomString(10);
211
+ const selected = optionItem.id == selectedItem?.id;
212
+ const disabled = optionItem.dataRow?.disabled ?? false;
213
+
214
+ const wrapperClass = [
215
+ "inv-rbchb",
216
+ "form-check",
217
+ "inv-mdfw-radio",
218
+ isSmall ? "inv-md-radio-sm" : ""
219
+ ].join(" ");
220
+
221
+ return (
222
+ <div class={wrapperClass}>
223
+ <div class="inv-cbrb-inner">
224
+ <input
225
+ class="form-check-input"
226
+ key={uuid}
227
+ checked={selected}
228
+ type="radio"
229
+ name={nameId}
230
+ id={uuid}
231
+ value={optionItem.id}
232
+ disabled={disabled}
233
+ onChange={() => this.handleRadioValueChanged()}
234
+ />
235
+ <label class="form-check-label" for={uuid}>
236
+ <HtmlLiteral innerHTML={optionItem.text} />
237
+ </label>
238
+ </div>
239
+ </div>
240
+ );
241
+ })}
242
+ </div>
243
+ );
244
+ }
221
245
  }
222
246
 
223
247
  const RadioButtonGroup = toNative(RadioButtonGroupComponent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
- "version": "0.0.104",
3
+ "version": "0.0.106",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": " vite build && vue-tsc --declaration --emitDeclarationOnly",