Skip to content

Commit 5a9e930

Browse files
committed
bug fix calendar options
1 parent 22b5262 commit 5a9e930

File tree

5 files changed

+59
-30
lines changed

5 files changed

+59
-30
lines changed

dist/vue-typed-ui.js

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,8 @@ var Calendar = function (_CalendarBase2) {
817817
value: function createComponent(ch) {
818818
var _this2 = this;
819819

820-
var children = [ch('i', { attrs: { 'class': this._icon + ' icon' } }), ch('input', { attrs: { type: 'text', name: this.name, placeholder: this.placeholder } })];
820+
var attr = this.calendarOptions();
821+
var children = [ch('i', { attrs: { 'class': attr.icon + ' icon' } }), ch('input', { attrs: { type: 'text', name: this.name, placeholder: this.placeholder } })];
821822
var css = 'ui input left icon';
822823
if (this.canClear) {
823824
css += ' action';
@@ -848,9 +849,10 @@ var Calendar = function (_CalendarBase2) {
848849
value: function setupUi() {
849850
var _this3 = this;
850851

852+
var attr = this.calendarOptions();
851853
var sender = this;
852854
var options$$1 = {
853-
type: this._type,
855+
type: attr.type,
854856
onChange: function onChange(date, text) {
855857
_this3.$emit('input', date);
856858
}
@@ -904,15 +906,18 @@ var Date = function (_DateBase2) {
904906

905907
function Date() {
906908
classCallCheck(this, Date);
907-
908-
var _this = possibleConstructorReturn(this, (Date.__proto__ || Object.getPrototypeOf(Date)).apply(this, arguments));
909-
910-
_this._type = 'date';
911-
_this._icon = 'calendar';
912-
return _this;
909+
return possibleConstructorReturn(this, (Date.__proto__ || Object.getPrototypeOf(Date)).apply(this, arguments));
913910
}
914911

915912
createClass(Date, [{
913+
key: 'calendarOptions',
914+
value: function calendarOptions() {
915+
return {
916+
type: 'date',
917+
icon: 'calendar'
918+
};
919+
}
920+
}, {
916921
key: 'onSettingsChanged',
917922
value: function onSettingsChanged(val) {
918923
$(this.$el)['calendar']('destroy');
@@ -963,15 +968,18 @@ var Time = function (_TimeBase2) {
963968

964969
function Time() {
965970
classCallCheck(this, Time);
966-
967-
var _this = possibleConstructorReturn(this, (Time.__proto__ || Object.getPrototypeOf(Time)).apply(this, arguments));
968-
969-
_this._type = 'time';
970-
_this._icon = 'time';
971-
return _this;
971+
return possibleConstructorReturn(this, (Time.__proto__ || Object.getPrototypeOf(Time)).apply(this, arguments));
972972
}
973973

974974
createClass(Time, [{
975+
key: 'calendarOptions',
976+
value: function calendarOptions() {
977+
return {
978+
type: 'time',
979+
icon: 'time'
980+
};
981+
}
982+
}, {
975983
key: 'onSettingsChanged',
976984
value: function onSettingsChanged(val) {
977985
$(this.$el)['calendar']('destroy');
@@ -1022,15 +1030,18 @@ var DateTime = function (_DatetimeBase2) {
10221030

10231031
function DateTime() {
10241032
classCallCheck(this, DateTime);
1025-
1026-
var _this = possibleConstructorReturn(this, (DateTime.__proto__ || Object.getPrototypeOf(DateTime)).apply(this, arguments));
1027-
1028-
_this._type = 'datetime';
1029-
_this._icon = 'calendar';
1030-
return _this;
1033+
return possibleConstructorReturn(this, (DateTime.__proto__ || Object.getPrototypeOf(DateTime)).apply(this, arguments));
10311034
}
10321035

10331036
createClass(DateTime, [{
1037+
key: 'calendarOptions',
1038+
value: function calendarOptions() {
1039+
return {
1040+
type: 'datetime',
1041+
icon: 'calendar'
1042+
};
1043+
}
1044+
}, {
10341045
key: 'onSettingsChanged',
10351046
value: function onSettingsChanged(val, old) {
10361047
if (old.dateFormat === val.dateFormat && old.timeFormat === val.timeFormat) return;

src/components/form-inputs/calendar/calendar/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ import { _CalendarBase } from './_base';
88
@Component()
99
export abstract class Calendar extends _CalendarBase {
1010

11-
abstract _type
12-
abstract _icon
11+
abstract calendarOptions() : {
12+
icon: string,
13+
type: string
14+
}
1315

1416
createComponent(ch) {
1517

18+
let attr = this.calendarOptions()
19+
1620
let children = [
17-
ch('i', { attrs: { 'class': this._icon + ' icon' } }),
21+
ch('i', { attrs: { 'class': attr.icon + ' icon' } }),
1822
ch('input', { attrs: { type: 'text', name: this.name, placeholder: this.placeholder, } })
1923
]
2024

@@ -52,9 +56,11 @@ export abstract class Calendar extends _CalendarBase {
5256

5357
setupUi() {
5458

59+
let attr = this.calendarOptions()
60+
5561
var sender = this
5662
var options = {
57-
type: this._type,
63+
type: attr.type,
5864
onChange: (date, text) => {
5965
this.$emit('input', date);
6066
}

src/components/form-inputs/calendar/date/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import { _DateBase } from './_base';
88
@Component()
99
export class Date extends _DateBase {
1010

11-
_type = 'date'
12-
_icon = 'calendar'
11+
calendarOptions() {
12+
return {
13+
type: 'date',
14+
icon: 'calendar'
15+
};
16+
}
1317

1418
@Watch('$UI.$settings.dateFormat')
1519
onSettingsChanged(val) {

src/components/form-inputs/calendar/datetime/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ import { _DatetimeBase } from './_base';
99
@Component()
1010
export class DateTime extends _DatetimeBase {
1111

12-
_type = 'datetime'
13-
_icon = 'calendar'
12+
calendarOptions() {
13+
return {
14+
type: 'datetime',
15+
icon: 'calendar'
16+
};
17+
}
1418

1519
@Watch('$UI.$settings')
1620
onSettingsChanged(val: Settings, old: Settings) {

src/components/form-inputs/calendar/time/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import { _TimeBase } from './_base';
88
@Component()
99
export class Time extends _TimeBase {
1010

11-
_type = 'time'
12-
_icon = 'time'
11+
calendarOptions() {
12+
return {
13+
type: 'time',
14+
icon: 'time'
15+
};
16+
}
1317

1418
@Watch('$UI.$settings.timeFormat')
1519
onSettingsChanged(val) {

0 commit comments

Comments
 (0)