inviton-powerduck 0.0.162 → 0.0.164

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.
@@ -43,7 +43,7 @@ class BootstrapToggleComponent extends TsxComponent<BootstrapToggleArgs> impleme
43
43
  @Prop() appendClicked: () => void;
44
44
  @Prop() prependClicked: () => void;
45
45
  @Prop() changed: (newValue: boolean) => void;
46
- @Prop() enabled!: boolean;
46
+ @Prop({ default: true }) enabled!: boolean;
47
47
  @Prop() captionTrue!: string;
48
48
  @Prop() captionFalse!: string;
49
49
  @Prop() marginType?: MarginType;
@@ -177,8 +177,11 @@ class BootstrapToggleComponent extends TsxComponent<BootstrapToggleArgs> impleme
177
177
  labelButtons={this.labelButtons}
178
178
  subtitle={this.subtitle}
179
179
  >
180
-
181
- <div class={`bs-toggle btn btn-light ${this.size || ''} ${this.value == true ? 'on' : 'off'}`} data-toggle="toggle" style={`width: ${width}px;`} onClick={() => { this.handleValueToggle(); }}>
180
+ <div class={`bs-toggle btn btn-light ${this.size || ''} ${this.value == true ? 'on' : 'off'} ${this.enabled === false ? 'disabled' : ''}`} data-toggle="toggle" style={`width: ${width}px;`} onClick={() => {
181
+ if (this.enabled != false) {
182
+ this.handleValueToggle();
183
+ }
184
+ }}>
182
185
  <div class="bs-toggle-group">
183
186
  <label class={`btn btn-${PowerduckState.getBootstrapOnStyle()} ${this.size || ''} bs-toggle-on`}>{this.getCaptionTrue()}</label>
184
187
  <label class={`btn btn-light ${this.size || ''} bs-toggle-off`}>{this.getCaptionFalse()}</label>
@@ -96,6 +96,8 @@ class ImageCropModalComponent extends TsxComponent<ImageCropModalBindingArgs> im
96
96
  maxWidth = containerWidth;
97
97
  }
98
98
 
99
+ // eslint-disable-next-line ts/no-this-alias
100
+ const mySelf = this;
99
101
  const start = TemporalUtils.dateNowMs();
100
102
  const img = new Image();
101
103
  img.onload = () => {
@@ -138,7 +140,7 @@ class ImageCropModalComponent extends TsxComponent<ImageCropModalBindingArgs> im
138
140
 
139
141
  (imgElem as any).Jcrop(cropParams, function (this: any) {
140
142
  (window as any).currentJCrop = this;
141
- this.blocked = false;
143
+ mySelf.blocked = false;
142
144
  });
143
145
  });
144
146
  };
@@ -48,6 +48,8 @@ interface DaterangePickerArgs extends FormItemWrapperArgs {
48
48
  singleMonth?: boolean;
49
49
  calendarPlacement?: 'body' | 'inline' | 'input-container-leftalign' | 'input-container-rightalign';
50
50
  ensureMonthContinuity?: boolean;
51
+ monthSelect?: boolean;
52
+ yearSelect?: boolean;
51
53
  customInputText?: () => string;
52
54
  customTooltip?: (dayCount: number) => string;
53
55
  maxDays?: number;
@@ -118,6 +120,8 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
118
120
  @Prop() hideYearInMonthName?: boolean;
119
121
  @Prop() disabled!: boolean;
120
122
  @Prop() readOnly?: boolean;
123
+ @Prop() monthSelect!: boolean;
124
+ @Prop() yearSelect!: boolean;
121
125
  @Prop() customTooltip?: (dayCount: number) => string;
122
126
  @Prop() maxDays?: number;
123
127
  @Prop() maxDaysTooltip?: (maxDays: number) => string;
@@ -171,6 +175,8 @@ class DaterangePickerComponent extends TsxComponent<DaterangePickerArgs> impleme
171
175
  autoClose: self.autoClose,
172
176
  ensureMonthContinuity: self.ensureMonthContinuity,
173
177
  maxDays: this.maxDays,
178
+ monthSelect: this.monthSelect != false,
179
+ yearSelect: this.yearSelect != false,
174
180
  getCellHtml: this.getCellHtml,
175
181
  maxDaysTooltip: this.maxDaysTooltip,
176
182
  calendarPlacement: this.calendarPlacement,
@@ -626,3 +626,10 @@
626
626
  .date-range-picker-root .date-range-length-tip.drp-tooltip-error {
627
627
  background-color: #b94c4c;
628
628
  }
629
+
630
+ .drp-date-switch.month-name {
631
+ border: 0;
632
+ appearance: none;
633
+ -webkit-appearance: none;
634
+ -moz-appearance: none;
635
+ }
@@ -405,6 +405,9 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
405
405
  defaultEndTime: Temporal.PlainDateTime
406
406
  ensureMonthContinuity: boolean
407
407
 
408
+ monthSelect: boolean
409
+ yearSelect: boolean
410
+
408
411
  month1: Temporal.PlainDateTime
409
412
  month2: Temporal.PlainDateTime
410
413
 
@@ -501,6 +504,8 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
501
504
  customCloseAnimation: null,
502
505
  customArrowPrevSymbol: null,
503
506
  customArrowNextSymbol: null,
507
+ monthSelect: false,
508
+ yearSelect: false,
504
509
  },
505
510
  opt,
506
511
  );
@@ -1873,11 +1878,127 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1873
1878
 
1874
1879
  function showMonth(date: Temporal.PlainDateTime, month: 'month1' | 'month2') {
1875
1880
  const monthName = nameMonth(date.month);
1876
- box.find(`.${month} .month-name`).html(`${monthName}${opt.hideYearInMonthName ? '' : ` ${date.year}`}`);
1881
+ var selectableMonthElement = generateSelectableMonthElement(date, month);
1882
+ var selectableYearElement = generateSelectableYearElement(date, month);
1883
+ box.find(`.${month} .month-name`).html(`${opt.monthSelect ? selectableMonthElement : monthName}${opt.hideYearInMonthName ? '' : ` ${opt.yearSelect ? selectableYearElement : date.year}`}`);
1877
1884
  box.find(`.${month} tbody`).html(createMonthHTML(date));
1878
1885
  opt[month] = date;
1879
1886
  updateSelectableRange();
1880
1887
  bindDayEvents();
1888
+ bindSelectEvents();
1889
+ }
1890
+
1891
+ function generateSelectableMonthElement(date: Temporal.PlainDateTime, month: 'month1' | 'month2'): string | null {
1892
+ const monthName = nameMonth(date.month);
1893
+ var nonSelectableMonth = '<div class="month-element">' + monthName + '</div>';
1894
+
1895
+ if (!opt.monthSelect) {
1896
+ return null;
1897
+ }
1898
+
1899
+ var startDate = opt.startDate ? opt.startDate.add({
1900
+ months: !opt.singleMonth && month === 'month2' ? 1 : 0
1901
+ }) : false;
1902
+ var endDate = opt.endDate ? opt.endDate.add({
1903
+ months: !opt.singleMonth && month === 'month1' ? -1 : 0
1904
+ }) : false;
1905
+
1906
+ var minSelectableMonth = startDate && date.year == startDate.year ? startDate.month : 1;
1907
+ var maxSelectableMonth = endDate && date.year == endDate.year ? endDate.month : 12;
1908
+ var minVisibleMonth = Math.min(minSelectableMonth, date.month);
1909
+ var maxVisibleMonth = Math.max(maxSelectableMonth, date.month);
1910
+
1911
+ if (minVisibleMonth === maxVisibleMonth) {
1912
+ return nonSelectableMonth;
1913
+ }
1914
+
1915
+ var selectData = generateSelectData(
1916
+ {
1917
+ minSelectable: minSelectableMonth,
1918
+ maxSelectable: maxSelectableMonth,
1919
+ minVisible: minVisibleMonth,
1920
+ maxVisible: maxVisibleMonth,
1921
+ },
1922
+ date.month,
1923
+ function (value: number): string { return nameMonth(value); }
1924
+ )
1925
+ return generateSelect('month', selectData);
1926
+ }
1927
+
1928
+ function generateSelectableYearElement(date: Temporal.PlainDateTime, month: 'month1' | 'month2'): string | null {
1929
+ const year = date.year;
1930
+ var nonSelectableYear = '<div class="year-element">' + year + '</div>';
1931
+
1932
+ if (!opt.yearSelect) {
1933
+ return null;
1934
+ }
1935
+
1936
+ var startDate = opt.startDate ? opt.startDate.add({
1937
+ months: !opt.singleMonth && month === 'month2' ? 1 : 0
1938
+ }) : false;
1939
+ var endDate = opt.endDate ? opt.endDate.add({
1940
+ months: !opt.singleMonth && month === 'month1' ? -1 : 0
1941
+ }) : false;
1942
+ var range = [year - 10, year + 10];
1943
+
1944
+ var minSelectableYear = startDate ? Math.max(range[0], startDate.year) : Math.min(range[0], year);
1945
+ var maxSelectableYear = endDate ? Math.min(range[1], endDate.year) : Math.max(range[1], year);
1946
+ var minVisibleYear = Math.min(minSelectableYear, year);
1947
+ var maxVisibleYear = Math.max(maxSelectableYear, year);
1948
+
1949
+ if (minVisibleYear === maxVisibleYear) {
1950
+ return nonSelectableYear;
1951
+ }
1952
+
1953
+ var selectData = generateSelectData(
1954
+ {
1955
+ minSelectable: minSelectableYear,
1956
+ maxSelectable: maxSelectableYear,
1957
+ minVisible: minVisibleYear,
1958
+ maxVisible: maxVisibleYear,
1959
+ },
1960
+ year,
1961
+ function (value: number): number { return value; }
1962
+ );
1963
+
1964
+ return generateSelect('year', selectData);
1965
+ }
1966
+
1967
+ function generateSelectData(range: { minVisible: number, maxVisible: number, minSelectable: number, maxSelectable: number }, current: number, valueBeautifier: (value: number) => string | number): Array<{ value: number, text: string | number, selected: boolean, disabled: boolean }> {
1968
+ var data: Array<{ value: number, text: string | number, selected: boolean, disabled: boolean }> = [];
1969
+ valueBeautifier = valueBeautifier || function (value: number): number { return value; };
1970
+
1971
+ for (var i = range.minVisible; i <= range.maxVisible; i++) {
1972
+ data.push({
1973
+ value: i,
1974
+ text: valueBeautifier(i),
1975
+ selected: i === current,
1976
+ disabled: ((i < range.minSelectable) || (i > range.maxSelectable)),
1977
+ });
1978
+ }
1979
+
1980
+ return data;
1981
+ }
1982
+ function generateSelect(name: string, data: Array<{ value: number, text: string | number, selected: boolean, disabled: boolean }>): string {
1983
+ var select = '<span class="select-wrapper"><select class="drp-date-switch month-name ' + name + '" name="' + name + '">';
1984
+ var current: string | number = '';
1985
+
1986
+ for (var i = 0, l = data.length; i < l; i++) {
1987
+ var item = data[i];
1988
+ select += '<option value="' + item.value + '"' +
1989
+ (item.selected ? ' selected' : '') +
1990
+ (item.disabled ? ' disabled' : '') + '>' +
1991
+ item.text + '</option>';
1992
+
1993
+ if (item.selected) {
1994
+ current = item.text;
1995
+ }
1996
+ }
1997
+
1998
+ // select += '</select><span class="select-display">' + current + '</span></div>';
1999
+ select += '</select><span class="select-display"></span></span>';
2000
+
2001
+ return select;
1881
2002
  }
1882
2003
 
1883
2004
  function bindDayEvents(): void {
@@ -1901,6 +2022,30 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1901
2022
  });
1902
2023
  }
1903
2024
 
2025
+ function bindSelectEvents(): void {
2026
+ box.find('select.month').unbind('change').change(function (this: any) {
2027
+ const selectedMonth = parseInt($(this).val());
2028
+ const selectedText = $(this).find('option:selected').text();
2029
+ $(this).siblings('.select-display').text(selectedText);
2030
+
2031
+ const isMonth2 = $(this).closest('table').hasClass('month2');
2032
+ const currentDate = isMonth2 ? opt.month2 : opt.month1;
2033
+ const newDate = currentDate.with({ month: selectedMonth });
2034
+ showMonth(newDate, isMonth2 ? 'month2' : 'month1');
2035
+ });
2036
+
2037
+ box.find('select.year').unbind('change').change(function (this: any) {
2038
+ const selectedYear = parseInt($(this).val());
2039
+ const selectedText = $(this).find('option:selected').text();
2040
+ $(this).siblings('.select-display').text(selectedText);
2041
+
2042
+ const isMonth2 = $(this).closest('table').hasClass('month2');
2043
+ const currentDate = isMonth2 ? opt.month2 : opt.month1;
2044
+ const newDate = currentDate.with({ year: selectedYear });
2045
+ showMonth(newDate, isMonth2 ? 'month2' : 'month1');
2046
+ });
2047
+ }
2048
+
1904
2049
  function showTime(date: Temporal.PlainDateTime, name: 'time1' | 'time2') {
1905
2050
  box.find(`.${name}`).append(getTimeHTML());
1906
2051
  renderTime(name, date);
@@ -1,6 +1,7 @@
1
1
  import type { Vue } from 'vue-facing-decorator';
2
2
  import SwiperCore from 'swiper';
3
- import { Navigation, Pagination } from 'swiper/modules';
3
+ import { Navigation, Pagination, Autoplay } from 'swiper/modules';
4
+ import { AutoplayOptions } from 'swiper/types';
4
5
  import { Prop, toNative } from 'vue-facing-decorator';
5
6
  import TsxComponent, { Component } from '../../app/vuetsx';
6
7
  import 'swiper/css';
@@ -13,6 +14,7 @@ interface IVue extends VueType { }
13
14
  SwiperCore.use([
14
15
  Navigation,
15
16
  Pagination,
17
+ Autoplay,
16
18
  ]);
17
19
 
18
20
  interface SwiperArgs {
@@ -24,7 +26,7 @@ interface SwiperArgs {
24
26
  freeMode?: boolean;
25
27
  grabCursor?: boolean;
26
28
  speed?: number;
27
- autoplay?: boolean;
29
+ autoplay?: AutoplayOptions;
28
30
  preventClicks?: boolean;
29
31
  navigation?: { nextEl: () => HTMLElement | string | IVue; prevEl: () => HTMLElement | string | IVue };
30
32
  slideChanged?: (e?: SwiperSlideChangedArgs) => void;
@@ -47,7 +49,6 @@ export interface SwiperZoomArgs {
47
49
 
48
50
  @Component
49
51
  class SwiperComponent extends TsxComponent<SwiperArgs> implements SwiperArgs {
50
- @Prop() key: string;
51
52
  @Prop() hasPagination?: boolean;
52
53
  @Prop() direction?: 'horizontal' | 'vertical';
53
54
  @Prop() slidesPerView?: 'auto' | number;
@@ -56,7 +57,7 @@ class SwiperComponent extends TsxComponent<SwiperArgs> implements SwiperArgs {
56
57
  @Prop() freeMode?: boolean;
57
58
  @Prop() grabCursor?: boolean;
58
59
  @Prop() speed: number;
59
- @Prop() autoplay: boolean;
60
+ @Prop() autoplay: AutoplayOptions;
60
61
  @Prop() preventClicks: boolean;
61
62
  @Prop() navigation?: { nextEl: () => HTMLElement | string | IVue; prevEl: () => HTMLElement | string | IVue };
62
63
  @Prop() zoom?: boolean | SwiperZoomArgs;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.162",
4
+ "version": "0.0.164",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",