2448 lines
124 KiB
JavaScript
2448 lines
124 KiB
JavaScript
/*!
|
||
* Angular Material Design KMI
|
||
* v3.0.0
|
||
* author Dustdusk
|
||
*/
|
||
var moment, d3, sortablejs;
|
||
try {
|
||
moment = require('moment');
|
||
d3 = require('d3');
|
||
sortablejs = require('sortablejs');
|
||
} catch (e) {
|
||
moment = moment;
|
||
}
|
||
|
||
(function (window, angular, moment, d3, sortablejs) {
|
||
'use strict';
|
||
var isMobile = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/);
|
||
|
||
(function () {
|
||
'use strict';
|
||
angular.module('ngMaterialLite', ['ng', 'pascalprecht.translate', 'material.components.dialog', 'material.components.datePicker', 'material.components.calculater', 'material.components.dashboard', 'material.components.barcode', 'material.components.list', 'material.components.toast', 'material.components.Marquee'])
|
||
.directive('kmiCanClick', function () {
|
||
return {
|
||
restrict: 'C',
|
||
link: function (scope, elem) {
|
||
var startEvent, endEvent;
|
||
if (isMobile) {
|
||
startEvent = 'touchstart';
|
||
endEvent = 'touchend';
|
||
} else {
|
||
startEvent = 'mousedown';
|
||
endEvent = 'mouseup mouseleave';
|
||
}
|
||
|
||
$(elem[0]).on(startEvent, function () {
|
||
if (angular.element(elem[0]).parent().attr('disabled') != 'disabled')
|
||
angular.element(elem[0]).addClass('is-active');
|
||
});
|
||
$(elem[0]).on(endEvent, function () {
|
||
if (angular.element(elem[0]).parent().attr('disabled') != 'disabled')
|
||
angular.element(elem[0]).removeClass('is-active');
|
||
});
|
||
}
|
||
};
|
||
});
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
var dialogContent,
|
||
dialogInstances = {};
|
||
//backupDialog = [],
|
||
//backupContent = [],
|
||
//nowScope,
|
||
//nowContent;
|
||
|
||
angular
|
||
.module('material.components.dialog', [])
|
||
.provider('$mdDialog', function () {
|
||
|
||
function appendDialog(template, options) {
|
||
options.templateRequest(template).then(function (respose) {
|
||
nowContent = options.compile('<div class="dialog-lay lay-hide" >' + respose + '</div>')(dialogScope);
|
||
angular.element(dialogContent).append(nowContent);
|
||
dialog.show(function () {
|
||
options.timeout(function () {
|
||
angular.element(nowContent).removeClass('lay-hide');
|
||
//20170620 modify by Dustdusk for 新增開窗後事件beforeShown
|
||
if (dialog.beforeShown) {
|
||
dialog.beforeShown();
|
||
}
|
||
}, 10);
|
||
});
|
||
});
|
||
}
|
||
|
||
function initDialogScope(instance, $css) {
|
||
instance.scope.dialog = {};
|
||
//20190807 add by Dustdusk for M#: 取得開窗GUID
|
||
instance.scope.dialog.getGUID = function () {
|
||
return instance.guid;
|
||
};
|
||
//20190807 add by Dustdusk for M#: 取得Dialog的Scope
|
||
instance.scope.dialog.getDialogScope = function () {
|
||
return instance.scope;
|
||
};
|
||
instance.scope.dialog.hide = function (callback) {
|
||
//沒有舊版的就全部關閉
|
||
//instance.scope.dialog.isShow = false;
|
||
angular.element(instance.content).remove();;
|
||
if (instance.scope.dialog.css_url)
|
||
$css.remove(instance.scope.dialog.css_url);
|
||
instance.scope.$destroy();
|
||
delete dialogInstances[instance.guid];
|
||
if (Object.keys(dialogInstances).length == 0) {
|
||
angular.element(dialogContent).html('');
|
||
angular.element(dialogContent).addClass('ng-hide');
|
||
}
|
||
|
||
if (typeof callback === 'function') {
|
||
callback();
|
||
}
|
||
};
|
||
instance.scope.dialog.show = function (feedback) {
|
||
//20180201 modify by Dustdusk for 附加CSS上去
|
||
if (instance.scope.dialog.css_url) {
|
||
$css.add(instance.scope.dialog.css_url);
|
||
}
|
||
angular.element(dialogContent).removeClass('ng-hide');
|
||
dialogInstances[instance.guid] = instance;
|
||
if (typeof (feedback) == 'function')
|
||
feedback(instance);
|
||
};
|
||
return instance;
|
||
}
|
||
|
||
function CreateDialog(providers, options) {
|
||
providers.templateRequest(options.templateURL).then(function (respose) {
|
||
var _dialog_instance = {
|
||
guid: Date.now(),
|
||
scope: providers.rootScope.$new(true)
|
||
}
|
||
try {
|
||
_dialog_instance = initDialogScope(_dialog_instance, providers.css);
|
||
_dialog_instance.scope.dialog = angular.extend(_dialog_instance.scope.dialog, options.controller(_dialog_instance.scope.dialog));
|
||
//20180801 modify by Dustdusk for 增加組裝html;
|
||
if (_dialog_instance.scope.dialog.beforeCompile) {
|
||
respose = _dialog_instance.scope.dialog.beforeCompile($(respose)).prop('outerHTML');
|
||
}
|
||
_dialog_instance.content = providers.compile('<div class="dialog-lay lay-hide" ng-class="dialog.background.class"><div class="dialog-lay-background" ng-click="dialog.background.click();"></div>' + respose + '</div>')(_dialog_instance.scope);
|
||
angular.element(dialogContent).append(_dialog_instance.content);
|
||
} catch (e) {
|
||
console.error(e);
|
||
_dialog_instance.scope.$destroy();
|
||
delete _dialog_instance.scope;
|
||
}
|
||
if (_dialog_instance.scope) {
|
||
_dialog_instance.scope.dialog.show(function () {
|
||
providers.timeout(function () {
|
||
angular.element(_dialog_instance.content).removeClass('lay-hide');
|
||
//20170620 modify by Dustdusk for 新增開窗後事件beforeShown
|
||
if (_dialog_instance.scope.dialog.beforeShown) {
|
||
_dialog_instance.scope.dialog.beforeShown();
|
||
}
|
||
}, 10);
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
function closeDialog(callback) {
|
||
for (var guid in Object.keys(dialogInstances)) {
|
||
dialogInstances[guid].scope.dialog.hide();
|
||
}
|
||
if (typeof callback === 'function') {
|
||
callback();
|
||
}
|
||
}
|
||
|
||
this.$get = ['$compile', '$templateRequest', '$controller', '$rootScope', '$timeout', '$css',
|
||
function ($compile, $templateRequest, $controller, $rootScope, $timeout, $css) {
|
||
return {
|
||
alert: function (msg, level, feedback) {
|
||
if (typeof (level) == 'function') {
|
||
feedback = level;
|
||
level = '';
|
||
}
|
||
CreateDialog({
|
||
templateRequest: $templateRequest,
|
||
compile: $compile,
|
||
timeout: $timeout,
|
||
css: $css,
|
||
rootScope: $rootScope
|
||
}, {
|
||
templateURL: 'JSplugins/angular-material-lite/template/alert.tmp.html',
|
||
controller: function (dialog) {
|
||
return {
|
||
content: msg,
|
||
level: level,
|
||
confirm: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
},
|
||
background: {
|
||
click: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
}
|
||
},
|
||
}
|
||
}
|
||
});
|
||
},
|
||
alert_full: function (content, level, feedback) {
|
||
if (typeof (level) == 'function') {
|
||
feedback = level;
|
||
level = '';
|
||
}
|
||
CreateDialog({
|
||
templateRequest: $templateRequest,
|
||
compile: $compile,
|
||
timeout: $timeout,
|
||
css: $css,
|
||
rootScope: $rootScope
|
||
}, {
|
||
templateURL: 'JSplugins/angular-material-lite/template/alert_full.tmp.html',
|
||
controller: function (dialog) {
|
||
|
||
//20200924 雋辰,不使用展開、隱藏的方式呈現
|
||
//dialog.show_detail = false;
|
||
|
||
return {
|
||
title: content.title,
|
||
code: content.code,
|
||
message: content.message,
|
||
exception: content.exception,
|
||
stack: content.stack ? content.stack.replace(/\r\n/, '<br />') : "",
|
||
level: level,
|
||
background: {
|
||
click: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
}
|
||
},
|
||
back: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
},
|
||
confirm: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
alert_top_right: function (content, level, feedback) {
|
||
if (typeof (level) == 'function') {
|
||
feedback = level;
|
||
level = '';
|
||
}
|
||
CreateDialog({
|
||
templateRequest: $templateRequest,
|
||
compile: $compile,
|
||
timeout: $timeout,
|
||
css: $css,
|
||
rootScope: $rootScope
|
||
}, {
|
||
templateURL: 'JSplugins/angular-material-lite/template/alert_top_right.tmp.html',
|
||
controller: function (dialog) {
|
||
//2020/09/22 雋辰,進出站完成視窗增加LinkName資訊
|
||
dialog.LinkName = content.LinkName;
|
||
dialog.show_detail = false;
|
||
|
||
return {
|
||
title: content.title,
|
||
item: content.item,
|
||
message: content.message,
|
||
level: level,
|
||
background: {
|
||
click: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
}
|
||
},
|
||
confirm: function () {
|
||
dialog.hide();
|
||
if (typeof (feedback) == 'function')
|
||
feedback();
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
confirm: function (msg, confirm, cancel) {
|
||
CreateDialog({
|
||
templateRequest: $templateRequest,
|
||
compile: $compile,
|
||
timeout: $timeout,
|
||
css: $css,
|
||
rootScope: $rootScope
|
||
}, {
|
||
templateURL: 'JSplugins/angular-material-lite/template/confirm.tmp.html',
|
||
controller: function (dialog) {
|
||
return {
|
||
background: { class: ['confirm-background'] },
|
||
content: msg,
|
||
confirm: confirm,
|
||
cancel: cancel || function () {
|
||
dialog.hide();
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
dialog: function (templateURL, controller) {
|
||
CreateDialog({
|
||
templateRequest: $templateRequest,
|
||
compile: $compile,
|
||
css: $css,
|
||
timeout: $timeout,
|
||
rootScope: $rootScope
|
||
}, {
|
||
templateURL: templateURL,
|
||
controller: controller
|
||
});
|
||
},
|
||
//20190807 add by Dustdusk for M#: 透過名稱取得Service進行開窗
|
||
serviceDialog: function () {
|
||
if (arguments.length > 0) {
|
||
var _params = Array.prototype.slice.call(arguments);
|
||
var _service_name = _params.splice(0, 1)[0];
|
||
$rootScope.getService(_service_name, function (_service_instance) {
|
||
_service_instance.init.apply(null, _params);
|
||
});
|
||
}
|
||
},
|
||
//20190807 add by Dustdusk for M#: 透過GUID取得目前已開窗的實體
|
||
getDialogByGUID: function (guid) {
|
||
if (dialogInstances[guid])
|
||
return dialogInstances[guid].scope.dialog;
|
||
},
|
||
dialogObject: {
|
||
isShow: false,
|
||
content: '',
|
||
templateURL: '',
|
||
hide: function () {
|
||
//判斷有沒有舊版的dialog
|
||
if (!backupDialog[backupDialog.length - 1]) {
|
||
//沒有舊版的就全部關閉
|
||
dialog.isShow = false;
|
||
angular.element(dialogContent).html('');
|
||
backupDialog = [];
|
||
backupContent = [];
|
||
|
||
angular.extend(clearDialog(dialog), dialogObject);
|
||
//$timeout(function(){
|
||
angular.element(dialogContent).addClass('ng-hide');
|
||
//}, 300);
|
||
} else {
|
||
//有舊版的就把舊版的拉出來, 把新版的移除
|
||
angular.element(nowContent).remove();
|
||
|
||
angular.extend(clearDialog(dialog), backupDialog[backupDialog.length - 1]);
|
||
nowContent = backupContent[backupContent.length - 1];
|
||
|
||
backupDialog.splice(backupDialog.length - 1, 1);
|
||
backupContent.splice(backupContent.length - 1, 1);
|
||
//console.log(dialog);
|
||
}
|
||
},
|
||
show: function (feedback) {
|
||
//dialog.content = msg;
|
||
dialog.isShow = true;
|
||
angular.element(dialogContent).removeClass('ng-hide');
|
||
if (feedback)
|
||
feedback();
|
||
},
|
||
confirm: null,
|
||
cancel: function () {
|
||
dialog.hide();
|
||
},
|
||
controller: null
|
||
},
|
||
isShow: function () {
|
||
if (Object.keys(dialogInstances).length > 0)
|
||
return true;
|
||
else
|
||
return false;
|
||
},
|
||
closeAll: function (callback) {
|
||
closeDialog(callback);
|
||
}
|
||
};
|
||
}];
|
||
})
|
||
.config(function () {
|
||
angular.element(document.getElementsByTagName('body')).append('<div class="dialog-background ng-hide"></div>');
|
||
dialogContent = document.getElementsByClassName('dialog-background')[0];
|
||
})
|
||
;
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
angular
|
||
.module('material.components.datePicker', ['material.components.dialog'])
|
||
.provider('$datePicker', ['$translateProvider', function ($translateProvider) {
|
||
|
||
var DatePicker = (function () {
|
||
moment.locale('zh_TW', {
|
||
months: '1 月_2 月_3 月_4 月_5 月_6 月_7 月_8 月_9 月_10 月_11 月_12 月'.split('_'),
|
||
monthsShort: '1 月_2 月_3 月_4 月_5 月_6 月_7 月_8 月_9 月_10 月_11 月_12 月'.split('_'),
|
||
weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
||
weekdaysShort: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
||
weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
|
||
});
|
||
var pickDate; //選擇的日子
|
||
var today; //紀錄今天
|
||
var date; //目前頁面選擇的日子
|
||
|
||
var startDate;
|
||
var endDate;
|
||
|
||
var weekdays;
|
||
var dayArray;
|
||
var hourArray;
|
||
var minArray;
|
||
//var monthArray;
|
||
var datepickerURL;
|
||
var isYearList = false;
|
||
|
||
if (!last_hour) {
|
||
var last_hour = {
|
||
value: "00",
|
||
};
|
||
}
|
||
if (!last_min) {
|
||
var last_min = {
|
||
value: "00",
|
||
};
|
||
}
|
||
var hour_minute;
|
||
|
||
// constructors
|
||
function DatePicker(pickDate, limitDate) {
|
||
moment.locale($translateProvider.use());
|
||
// users
|
||
this.today = new Date();
|
||
this.weekdays = moment.weekdaysMin();
|
||
this.dayArray = [];
|
||
this.hourArray = [];
|
||
this.minArray = [];
|
||
for (let i = 0; i <= 23; i++) {
|
||
if (i < 10) {
|
||
i = '0' + String(i);
|
||
} else {
|
||
i = String(i);
|
||
}
|
||
if (last_hour.value === String(i)) {
|
||
this.hourArray.push(last_hour);
|
||
} else {
|
||
this.hourArray.push({
|
||
value: i,
|
||
is_selected: false
|
||
});
|
||
}
|
||
}
|
||
for (let i = 0; i <= 59; i++) {
|
||
if (i < 10) {
|
||
i = '0' + String(i);
|
||
}
|
||
if (last_min.value === String(i)) {
|
||
this.minArray.push(last_min);
|
||
} else {
|
||
this.minArray.push({
|
||
value: i,
|
||
is_selected: false
|
||
});
|
||
}
|
||
}
|
||
this.datepickerURL = 'JSplugins/angularMDL/template/mdl-datepicker.html';
|
||
|
||
this.pickDate = pickDate;
|
||
this.date = moment(pickDate).clone().toDate();
|
||
//this.date Mon Apr 20 2020 10:02:27 GMT+0800 (台北標準時間)
|
||
if (limitDate) {
|
||
this.startDate = limitDate.start;
|
||
this.endDate = limitDate.end;
|
||
}
|
||
this.monthDays();
|
||
}
|
||
|
||
//prev month
|
||
DatePicker.prototype.prevMonth = function () {
|
||
this.date = moment(this.date).add(-1, 'M').toDate();
|
||
this.monthDays();
|
||
};
|
||
|
||
//next month
|
||
DatePicker.prototype.nextMonth = function () {
|
||
this.date = moment(this.date).add(1, 'M').toDate();
|
||
this.monthDays();
|
||
};
|
||
|
||
DatePicker.prototype.showHourAndMin = function () {
|
||
hour_minute = last_hour.value + ":" + last_min.value;
|
||
return hour_minute;
|
||
}
|
||
|
||
// methods
|
||
//20151208 [modify] create day array
|
||
DatePicker.prototype.monthDays = function () {
|
||
var date = moment(this.date);
|
||
var tempDayArray = [];
|
||
for (var i = 0; i < date.startOf('month').day() ; i++) {
|
||
tempDayArray.push({
|
||
value: '',
|
||
isDisabled: true
|
||
});
|
||
}
|
||
var today = moment(this.today);
|
||
var pickDate = moment(this.pickDate);
|
||
for (var i = 1; i <= date.endOf('month').date() ; i++) {
|
||
var isDsiabled = true;
|
||
if (this.startDate != undefined) {
|
||
isDsiabled = isDsiabled && (date.date(i).isAfter(this.startDate) || date.date(i).isSame(this.startDate));
|
||
}
|
||
if (this.endDate != undefined) {
|
||
isDsiabled = isDsiabled && (date.date(i).isBefore(this.endDate) || date.date(i).isSame(this.endDate));
|
||
}
|
||
tempDayArray.push({
|
||
value: i,
|
||
isTody: today.isSame(this.date, 'month') && (today.date() == i),
|
||
isDisabled: !isDsiabled
|
||
});
|
||
}
|
||
this.dayArray = tempDayArray;
|
||
};
|
||
|
||
DatePicker.prototype.isEqual = function (day) {
|
||
var pickDate = moment(this.pickDate);
|
||
return pickDate.isSame(this.date, 'month') && (pickDate.date() == day);
|
||
};
|
||
|
||
DatePicker.prototype.pick = function (day) {
|
||
if (!day.isDisabled) {
|
||
var tempDate = moment(this.date).clone().date(day.value).hour(parseInt(last_hour.value)).minute(parseInt(last_min.value));
|
||
this.pickDate = tempDate.toDate();
|
||
}
|
||
};
|
||
|
||
DatePicker.prototype.dayClass = function (day) {
|
||
var dayClass = '';
|
||
if (this.isEqual(day.value)) {
|
||
dayClass += ' is-checked';
|
||
}
|
||
if (day.isTody) {
|
||
dayClass += ' mdl-datepicker-date__today';
|
||
}
|
||
return dayClass;
|
||
};
|
||
|
||
DatePicker.prototype.hourClass = function (hour) {
|
||
|
||
var hourClass = '';
|
||
|
||
if (moment(this.pickDate).hour() == parseInt(hour.value)) {
|
||
hourClass += ' is-checked';
|
||
last_hour = hour;
|
||
}
|
||
|
||
return hourClass
|
||
}
|
||
|
||
DatePicker.prototype.hourpick = function (hour) {
|
||
|
||
if (last_hour.is_selected == true) {
|
||
last_hour.is_selected = false;
|
||
}
|
||
hour.is_selected = true;
|
||
last_hour = hour;
|
||
|
||
var tempDate = moment(this.pickDate).clone().hour(parseInt(last_hour.value));
|
||
this.pickDate = tempDate.toDate();
|
||
}
|
||
|
||
DatePicker.prototype.minClass = function (min) {
|
||
|
||
var minClass = '';
|
||
|
||
if (moment(this.pickDate).minute() == parseInt(min.value)) {
|
||
minClass += ' is-checked';
|
||
last_min = min;
|
||
}
|
||
|
||
return minClass
|
||
}
|
||
|
||
DatePicker.prototype.minpick = function (min) {
|
||
|
||
if (last_min.is_selected == true) {
|
||
last_min.is_selected = false;
|
||
}
|
||
min.is_selected = true;
|
||
last_min = min;
|
||
|
||
var tempDate = moment(this.pickDate).clone().minute(parseInt(last_min.value));
|
||
this.pickDate = tempDate.toDate();
|
||
}
|
||
|
||
DatePicker.prototype.gotoToday = function () {
|
||
this.date.setFullYear(this.pickDate.getFullYear());
|
||
this.date.setMonth(this.pickDate.getMonth());
|
||
this.monthDays();
|
||
//this.isYearList = false;
|
||
};
|
||
|
||
DatePicker.prototype.displayMonth = function () {
|
||
return moment(this.date).format('YYYY 年 MMMM');
|
||
};
|
||
|
||
DatePicker.prototype.withoutTimeBar = function () {
|
||
return true;
|
||
};
|
||
|
||
DatePicker.prototype.displayHour = function () {
|
||
return moment(this.date).format('HH:mm');
|
||
}
|
||
|
||
DatePicker.prototype.displayPickDate = function () {
|
||
return moment(this.pickDate).format('dddd, MMM D');
|
||
};
|
||
/*
|
||
DatePicker.prototype.showYearList = function(){
|
||
this.isYearList = true;
|
||
this.yearMonth();
|
||
}
|
||
|
||
DatePicker.prototype.yearMonth = function(){
|
||
var tempMonthArray = [];
|
||
var month = this.pickDate.getMonth()-12;
|
||
for(var i = month ; i < 24;i++){
|
||
tempMonthArray.push({
|
||
year : 2000,
|
||
month: month+i
|
||
});
|
||
}
|
||
|
||
this.monthArray = tempMonthArray;
|
||
|
||
}
|
||
*/
|
||
// return
|
||
return DatePicker;
|
||
})();
|
||
|
||
this.$get = ['$mdDialog', function ($mdDialog) {
|
||
return {
|
||
open: function (pickDate, confirm, cancel, options) {
|
||
var datePickerInstance = new DatePicker(pickDate, options);
|
||
$mdDialog.dialog('JSplugins/angular-material-lite/template/datepicker.tmp.html', function (dialog) {
|
||
var returnObject = {};
|
||
returnObject.datePacker = datePickerInstance;
|
||
returnObject.confirm = confirm;
|
||
returnObject.background = {
|
||
click: function () {
|
||
dialog.hide();
|
||
}
|
||
};
|
||
if (cancel)
|
||
returnObject.cancel = cancel;
|
||
|
||
return returnObject;
|
||
});
|
||
},
|
||
getDatePickerInstance: function (pickDate, limitDate) {
|
||
return new DatePicker(pickDate, limitDate);
|
||
}
|
||
};
|
||
}];
|
||
}])
|
||
.directive('mdlDatepicker', ['$parse', '$datePicker', function ($parse, $datePicker) {
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
mdlDatepicker: '=', //日期
|
||
mdlDateMin: '=', //最小日期
|
||
mdlDateMax: '=' //最大日期
|
||
},
|
||
compile: function (tElem, tAttrs) {
|
||
return {
|
||
post: function (scope, element, attrs) {
|
||
var eventName;
|
||
if (isMobile) {
|
||
eventName = 'touchend';
|
||
} else {
|
||
eventName = 'mouseup';
|
||
}
|
||
angular.element(element[0]).attr('readonly', 'readonly').on(eventName, function () {
|
||
angular.element(element[0]).addClass('is-focus');
|
||
|
||
$datePicker.open(scope.mdlDatepicker || new Date(),
|
||
function (dialog) {
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
scope.mdlDatepicker = moment(dialog.datePacker.pickDate).format('YYYY/MM/DD HH:mm:ss');
|
||
dialog.hide();
|
||
},
|
||
function (dialog) {
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
dialog.hide();
|
||
},
|
||
{
|
||
start: scope.mdlDateMin,
|
||
end: scope.mdlDateMax
|
||
});
|
||
});
|
||
scope.$watch('mdlDatepicker', function (newVals, oldVals) {
|
||
if (newVals == undefined || newVals == '')
|
||
element[0].value = '';
|
||
else
|
||
element[0].value = moment(newVals).format('YYYY/MM/DD HH:mm:ss');
|
||
});
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}]);
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
angular
|
||
.module('material.components.calculater', ['material.components.dialog'])
|
||
.provider('$calculater', function () {
|
||
var calculater = (function () {
|
||
// constructors
|
||
/**
|
||
* options : {
|
||
* title,
|
||
* defaultNum,
|
||
* numMax:0,
|
||
* numMin:0,
|
||
* decimalMax:2,
|
||
* decimalMin:0,
|
||
* decimal:true/false,
|
||
* decimalLength:0,
|
||
* type: string/number/date
|
||
* }
|
||
*/
|
||
function Calculater(options) {
|
||
this.options = angular.merge({ type: 'number' }, options);
|
||
//20180531 modify by Dustdusk for 有輸入小數位數時則直接開啟小數輸入
|
||
if (this.options.decimalLength && this.options.decimalLength > 0) {
|
||
this.options.decimal = true;
|
||
}
|
||
this.options.title = this.options.title;
|
||
if (this.options.type == 'date') {
|
||
this.focus = 'hour';
|
||
var time = this.options.defaultNum.split(':');
|
||
try {
|
||
this.timeDisplay = { hour: time[0], minute: time[1], second: time[2] };
|
||
} catch (e) {
|
||
this.timeDisplay = { hour: '00', minute: '00', second: '00' };
|
||
}
|
||
} else {
|
||
if (this.options.enableEmpty == true)
|
||
this.numDisplay = '' + (this.options.defaultNum || '');
|
||
else
|
||
this.numDisplay = '' + (this.options.defaultNum || '0');
|
||
}
|
||
}
|
||
Calculater.prototype.addNum = function (numBtn) {
|
||
if (this.options.type != 'date') {
|
||
if (numBtn == '.' && this.numDisplay.indexOf(numBtn) != -1) {
|
||
return;
|
||
} else if (numBtn == '.' && !this.options.decimal) {
|
||
return;
|
||
}
|
||
if (this.options.type == 'number') {
|
||
if (numBtn != '.' && (this.numDisplay === '0' || this.numDisplay === '0%')) {
|
||
this.numDisplay = '';
|
||
} else if (this.numDisplay.indexOf('.') != -1) {
|
||
if (this.numDisplay.split('.')[1].length >= (+this.options.decimalLength)) {
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
//20201008 雋辰,百分比處理
|
||
if (this.numDisplay.includes('%'))
|
||
this.numDisplay = this.numDisplay.substr(0, this.numDisplay.length - 1) + numBtn + '%';
|
||
else
|
||
this.numDisplay += numBtn + '';
|
||
} else {
|
||
this.timeDisplay[this.focus] += numBtn + '';
|
||
}
|
||
};
|
||
|
||
Calculater.prototype.deleteNum = function () {
|
||
if (this.options.type != 'date') {
|
||
this.numDisplay = this.numDisplay.substr(0, this.numDisplay.length - 1);
|
||
if (this.options.type == 'number' && this.options.enableEmpty != true) {
|
||
if (this.numDisplay === '')
|
||
this.numDisplay = '0';
|
||
}
|
||
} else {
|
||
this.timeDisplay[this.focus] = this.timeDisplay[this.focus].substr(0, this.timeDisplay[this.focus].length - 1);
|
||
if (this.timeDisplay[this.focus] === '') {
|
||
this.timeDisplay[this.focus] = '00';
|
||
}
|
||
}
|
||
};
|
||
|
||
Calculater.prototype.confirmNum = function (confirm) {
|
||
//20201008 雋辰,百分比處理
|
||
var per = false;
|
||
if (this.numDisplay.includes('%')) {
|
||
this.numDisplay = this.numDisplay.substr(0, this.numDisplay.length - 1);
|
||
per = true;
|
||
}
|
||
|
||
if (this.options.enableEmpty == true) {
|
||
if (this.numDisplay != '')
|
||
this.numDisplay = new Number(this.numDisplay) + '';
|
||
} else if (this.options.type == 'number') {
|
||
this.numDisplay = new Number(this.numDisplay) + '';
|
||
|
||
//Mantis:0101514 SPC 平板數據計算機手順調整
|
||
if(this.numDisplay == "NaN"){
|
||
this.numDisplay = "0";
|
||
}
|
||
}
|
||
//20201008 雋辰,百分比處理
|
||
if (this.numDisplay != "NaN" && per)
|
||
this.numDisplay += '%';
|
||
|
||
if (confirm)
|
||
confirm(this.numDisplay);
|
||
};
|
||
|
||
//20200925 雋辰,負號處理
|
||
Calculater.prototype.negative = function () {
|
||
// if (this.numDisplay && this.numDisplay != '0' && this.numDisplay != '0%') {
|
||
// if (!this.numDisplay.includes('-'))
|
||
// this.numDisplay = '-' + this.numDisplay;
|
||
// else
|
||
// this.numDisplay = this.numDisplay.substr(1, this.numDisplay.length - 1);
|
||
// }
|
||
|
||
|
||
if (this.numDisplay && this.numDisplay != '0' && this.numDisplay != '0%') {
|
||
if (!this.numDisplay.includes('-')){
|
||
this.numDisplay = '-' + this.numDisplay;
|
||
}else{
|
||
//Mantis:0101514 SPC 平板數據計算機手順調整
|
||
if(this.numDisplay == '-'){
|
||
this.numDisplay = '0';
|
||
}else{
|
||
this.numDisplay = this.numDisplay.substr(1, this.numDisplay.length - 1);
|
||
}
|
||
}
|
||
|
||
}else{
|
||
//Mantis:0101514 SPC 平板數據計算機手順調整
|
||
if(this.numDisplay == '0'){
|
||
if (!this.numDisplay.includes('-')){
|
||
this.numDisplay = '-';
|
||
}
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
//20201007 雋辰,百分比處理
|
||
Calculater.prototype.percent = function () {
|
||
if (this.numDisplay) {
|
||
if (!this.numDisplay.includes('%'))
|
||
this.numDisplay = this.numDisplay + '%';
|
||
else
|
||
this.numDisplay = this.numDisplay.substr(0, this.numDisplay.length - 1);
|
||
}
|
||
};
|
||
|
||
return Calculater;
|
||
})();
|
||
|
||
this.$get = ['$mdDialog', '$filter', function ($mdDialog, $filter) {
|
||
return {
|
||
open: function (calcConfirm, calcCancel, options) {
|
||
options.title = options.title || $filter('translate')('common.msg.please_input_num');
|
||
var calculaterInstance = new calculater(options);
|
||
$mdDialog.dialog('JSplugins/angular-material-lite/template/SMTCalculater.tmp.html', function (dialog) {
|
||
//20201008 雋辰,百分比處理&負數處理
|
||
dialog.canPercent = false;
|
||
dialog.canNegative = false;
|
||
if (calculaterInstance.options.Percent) dialog.canPercent = calculaterInstance.options.Percent;
|
||
if (calculaterInstance.options.Negative) dialog.canNegative = calculaterInstance.options.Negative;
|
||
|
||
return {
|
||
calculater: calculaterInstance,
|
||
time_focus: {},
|
||
title: $filter('translate')('common.calc_num'),
|
||
beforeShown: function () {
|
||
if (this.calculater.options.type != 'date') {
|
||
//20170620 modify by Dustdusk for 新增開啟後focus(only on windows),Android裝置則是會readOnly
|
||
dialog.display = document.getElementById('calculater_display');
|
||
if (!window.cordova) {
|
||
dialog.display.focus();
|
||
dialog.display.select();
|
||
} else {
|
||
dialog.display.select();
|
||
dialog.display.readOnly = true;
|
||
}
|
||
} else {
|
||
dialog.hour_display = document.getElementById('hour_display');
|
||
dialog.minute_display = document.getElementById('minute_display');
|
||
dialog.second_display = document.getElementById('second_display');
|
||
if (!window.cordova) {
|
||
dialog.hour_display.focus();
|
||
dialog.hour_display.select();
|
||
} else {
|
||
dialog.hour_display.select();
|
||
dialog.hour_display.readOnly = true;
|
||
dialog.minute_display.readOnly = true;
|
||
dialog.second_display.readOnly = true;
|
||
}
|
||
}
|
||
},
|
||
//20170620 modify by Dustdusk for 控卡只能數字輸入
|
||
//20170622 modify by Dustdusk for Enter 輸入
|
||
key_input: function (event, type) {
|
||
if (dialog.calculater.options.type != 'date') {
|
||
if (event.keyCode == 13) {
|
||
dialog.calculater.confirmNum(dialog.confirm);
|
||
} else if (event.keyCode >= 48 && event.keyCode <= 57) {
|
||
if (dialog.calculater.options.type == 'number') {
|
||
if (dialog.calculater.numDisplay === '0') {
|
||
dialog.calculater.numDisplay = '';
|
||
}
|
||
if (dialog.calculater.options.decimal && dialog.calculater.numDisplay.indexOf('.') != -1) {
|
||
if (dialog.calculater.numDisplay.split('.')[1].length > (+dialog.calculater.options.decimalLength)) {
|
||
event.stopPropagation();
|
||
event.preventDefault();
|
||
}
|
||
}
|
||
}
|
||
} else if (dialog.calculater.options.decimal
|
||
&& event.keyCode == 46
|
||
&& dialog.calculater.numDisplay.indexOf('.') == -1) {
|
||
|
||
} else {
|
||
event.stopPropagation();
|
||
event.preventDefault();
|
||
}
|
||
} else {
|
||
if (event.keyCode == 13) {
|
||
if (dialog.calculater.focus == 'hour') {
|
||
dialog.calculater.focus = 'minute';
|
||
dialog.minute_display.select();
|
||
if (!window.cordova)
|
||
dialog.minute_display.focus();
|
||
} else if (dialog.calculater.focus == 'minute') {
|
||
dialog.calculater.focus = 'second';
|
||
dialog.second_display.select();
|
||
if (!window.cordova)
|
||
dialog.second_display.focus();
|
||
} else if (dialog.calculater.focus == 'second') {
|
||
dialog.confirm();
|
||
}
|
||
} else if (event.keyCode >= 48 && event.keyCode <= 57) {
|
||
if (dialog.calculater.timeDisplay[dialog.calculater.focus].length >= 2) {
|
||
dialog.calculater.timeDisplay[dialog.calculater.focus] = '';
|
||
}
|
||
} else {
|
||
event.stopPropagation();
|
||
event.preventDefault();
|
||
}
|
||
}
|
||
},
|
||
add_num: function (num) {
|
||
if (dialog.calculater.options.type == 'date') {
|
||
if (dialog.calculater.timeDisplay[dialog.calculater.focus].length >= 2) {
|
||
dialog.calculater.timeDisplay[dialog.calculater.focus] = '';
|
||
}
|
||
dialog.calculater.addNum(num);
|
||
//當輸入完為2位則自動切換到下一格
|
||
if (dialog.calculater.timeDisplay[dialog.calculater.focus].length == 2) {
|
||
if (dialog.calculater.focus == 'hour') {
|
||
dialog.calculater.focus = 'minute';
|
||
} else if (dialog.calculater.focus == 'minute') {
|
||
dialog.calculater.focus = 'second';
|
||
} else if (dialog.calculater.focus == 'second') {
|
||
dialog.confirm();
|
||
}
|
||
}
|
||
} else {
|
||
if (dialog.display.selectionStart == dialog.display.selectionEnd) {
|
||
dialog.calculater.addNum(num);
|
||
} else {
|
||
var display_str = dialog.display.value;
|
||
var startStr = display_str.substring(0, dialog.display.selectionStart);
|
||
var endStr = display_str.substring(dialog.display.selectionEnd, display_str.length);
|
||
|
||
dialog.calculater.numDisplay = '';
|
||
dialog.calculater.addNum(num);
|
||
dialog.calculater.numDisplay = startStr + dialog.calculater.numDisplay + endStr;
|
||
//20181221 modify by Dustdusk for M#: 單一數字時會無法使用螢幕鍵盤輸入
|
||
//因此每次輸入後手動重製selectEnd、selectStart
|
||
if (!window.cordova) {
|
||
dialog.display.focus();
|
||
dialog.display.setSelectionRange(dialog.display.selectionStart + 1, dialog.display.selectionStart + 1);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
deleteNum: function () {
|
||
if (dialog.calculater.options.type == 'date') {
|
||
dialog.calculater.deleteNum();
|
||
} else {
|
||
if (dialog.display.selectionStart == dialog.display.selectionEnd) {
|
||
dialog.calculater.deleteNum();
|
||
} else {
|
||
var startStr = dialog.calculater.numDisplay.substring(0, dialog.display.selectionStart);
|
||
var endStr = dialog.calculater.numDisplay.substring(dialog.display.selectionEnd, dialog.calculater.numDisplay.length);
|
||
dialog.calculater.numDisplay = startStr + endStr;
|
||
if (dialog.calculater.options.type == 'number' && dialog.calculater.options.enableEmpty != true) {
|
||
if (dialog.calculater.numDisplay == '') {
|
||
dialog.calculater.numDisplay = '0';
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
confirm: function (numDisplay) {
|
||
//20201117 雋辰,calcConfirm有最大小值卡控增加此函式決定是否需執行html callback
|
||
var result = false;
|
||
if (dialog.calculater.options.type != 'date') {
|
||
dialog.calculater.confirmNum(function () {
|
||
result = calcConfirm(dialog.calculater.numDisplay, dialog);
|
||
});
|
||
} else {
|
||
result = calcConfirm(dialog.calculater.timeDisplay, dialog);
|
||
}
|
||
|
||
if (result && options.Confirm)
|
||
options.Confirm(dialog.calculater.numDisplay, dialog);
|
||
},
|
||
cancel: function () {
|
||
if (calcCancel)
|
||
calcCancel(dialog);
|
||
|
||
if (options.Cancel)
|
||
options.Cancel(dialog);
|
||
},
|
||
back: function () {
|
||
dialog.hide();
|
||
},
|
||
background: {
|
||
class: ['calculater-background'],
|
||
click: function (event) {
|
||
//20191107 modify by Dustdusk for M#: 修正開窗很難點
|
||
if (!window.cordova) {
|
||
if (dialog.cancel)
|
||
dialog.cancel();
|
||
}
|
||
}
|
||
},
|
||
negative: function () {
|
||
dialog.calculater.negative();
|
||
},
|
||
percent: function () {
|
||
dialog.calculater.percent();
|
||
},
|
||
clear: function () {
|
||
dialog.calculater.numDisplay = '0';
|
||
}
|
||
};
|
||
});
|
||
},
|
||
decimalAdd: function (num1, num2) {
|
||
var r1, r2, m;
|
||
try {
|
||
r1 = num1.toString().split('.')[1].length;
|
||
} catch (e) {
|
||
r1 = 0;
|
||
}
|
||
try {
|
||
r2 = num2.toString().split('.')[1].length;
|
||
} catch (e) {
|
||
r2 = 0;
|
||
}
|
||
m = Math.pow(10, Math.max(r1, r2));
|
||
return Math.round(num1 * m + num2 * m) / m;
|
||
},
|
||
decimalSub: function (num1, num2) {
|
||
var r1, r2, m;
|
||
try {
|
||
r1 = num1.toString().split('.')[1].length;
|
||
} catch (e) {
|
||
r1 = 0;
|
||
}
|
||
try {
|
||
r2 = num2.toString().split('.')[1].length;
|
||
} catch (e) {
|
||
r2 = 0;
|
||
}
|
||
m = Math.pow(10, Math.max(r1, r2));
|
||
return Math.round(num1 * m - num2 * m) / m;
|
||
},
|
||
decimalMutiple: function (num1, num2, decimal_length) {
|
||
var m = 0, s1 = num1.toString(), s2 = num2.toString();
|
||
try {
|
||
m += s1.split('.')[1].length;
|
||
} catch (e) {
|
||
|
||
}
|
||
try {
|
||
m += s2.split('.')[1].length;
|
||
} catch (e) {
|
||
|
||
}
|
||
if (decimal_length) {
|
||
if (m > (+decimal_length)) {
|
||
var temp = Number(s1.replace('.', '')) * Number(s2.replace('.', ''));
|
||
temp = Math.round(temp / Math.pow(10, (m - (+decimal_length))));
|
||
return temp / Math.pow(10, decimal_length);
|
||
} else {
|
||
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m);
|
||
}
|
||
} else {
|
||
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m);
|
||
}
|
||
}
|
||
};
|
||
}];
|
||
})
|
||
.directive('mdlCalculater', ['$parse', '$calculater', '$filter', function ($parse, $calculater, $filter) {
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
mdlCalculater: '=',
|
||
mdlCalculaterTitle: '@',
|
||
mdlCalculaterDecimal: '=',
|
||
mdlCalculaterDecimalLength: '=',
|
||
mdlCalculaterNoZero: '=',
|
||
mdlCalculaterMax: '=',
|
||
mdlCalculaterMin: '=',
|
||
enableEmpty: '=',
|
||
mdlCalculaterNegative: '=',
|
||
mdlCalculaterPercent: '=',
|
||
mdlCalculaterConfirm: '=',
|
||
mdlCalculaterCancel: '='
|
||
},
|
||
compile: function () {
|
||
return {
|
||
post: function (scope, element) {
|
||
var eventName;
|
||
if (isMobile) {
|
||
eventName = 'touchend';
|
||
} else {
|
||
eventName = 'mouseup';
|
||
}
|
||
angular.element(element[0]).attr('readonly', 'readonly').on(eventName, function () {
|
||
angular.element(element[0]).addClass('is-focus');
|
||
//20201117 雋辰,增加html confirm callback
|
||
//20201117 雋辰,增加html confirm callback
|
||
var options = {
|
||
defaultNum: scope.mdlCalculater,
|
||
title: scope.mdlCalculaterTitle,
|
||
decimal: scope.mdlCalculaterDecimal,
|
||
decimalLength: scope.mdlCalculaterDecimalLength,
|
||
enableEmpty: scope.enableEmpty,
|
||
Negative: scope.mdlCalculaterNegative,
|
||
Percent: scope.mdlCalculaterPercent,
|
||
Confirm: scope.mdlCalculaterConfirm,
|
||
Cancel: scope.mdlCalculaterCancel
|
||
};
|
||
$calculater.open(function(num, dialog) {
|
||
scope.mdlCalculaterTitle = scope.mdlCalculaterTitle || '';
|
||
var msg = '';
|
||
if (scope.mdlCalculaterMax && (+scope.mdlCalculaterMax) < (+num)) {
|
||
msg += scope.mdlCalculaterTitle + $filter('translate')('common.msg.great_than') + scope.mdlCalculaterMax + '<br>';
|
||
}
|
||
|
||
if (scope.mdlCalculaterMin && (+scope.mdlCalculaterMin) > (+num)) {
|
||
msg += scope.mdlCalculaterTitle + $filter('translate')('common.msg.less_than') + scope.mdlCalculaterMin + '<br>';
|
||
}
|
||
|
||
if (scope.mdlCalculaterNoZero && (+num) == 0) {
|
||
msg += scope.mdlCalculaterTitle + $filter('translate')('common.msg.input_zero') + '<br>';
|
||
}
|
||
|
||
if (msg == '') {
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
scope.mdlCalculater = num;
|
||
dialog.hide();
|
||
return true;
|
||
} else {
|
||
if (scope.$root.showAlert)
|
||
scope.$root.showAlert(msg);
|
||
return false;
|
||
}
|
||
},
|
||
function (dialog) {
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
dialog.hide();
|
||
}, options);
|
||
});
|
||
scope.$watch('mdlCalculater', function (newVals, oldVals) {
|
||
if(newVals == undefined)
|
||
element[0].value = '';
|
||
else
|
||
element[0].value = newVals;
|
||
});
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}])
|
||
.directive('mdlTimepicker', ['$parse', '$calculater', '$filter', function ($parse, $calculater, $filter) {
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
mdlTimepicker: '=',
|
||
mdlTimepickerTitle: '@'
|
||
},
|
||
compile: function () {
|
||
return {
|
||
post: function (scope, element) {
|
||
var eventName;
|
||
if (isMobile) {
|
||
eventName = 'touchend';
|
||
} else {
|
||
eventName = 'mouseup';
|
||
}
|
||
angular.element(element[0]).attr('readonly', 'readonly').on(eventName, function () {
|
||
angular.element(element[0]).addClass('is-focus');
|
||
scope.mdlTimepicker = scope.mdlTimepicker || '';
|
||
var options = {
|
||
defaultNum: scope.mdlTimepicker,//.replace(/:/g,''),
|
||
title: $filter('translate')('common.msg.select_time'),
|
||
decimal: false,
|
||
type: 'date'
|
||
};
|
||
$calculater.open(function(timeDisplay, dialog) {
|
||
var hour = timeDisplay.hour, min = timeDisplay.minute, sec = timeDisplay.second;
|
||
if ((0 <= (+hour) && (+hour) < 24) && (0 <= (+min) && (+min) < 60) && (0 <= (+sec) && (+sec) < 60)) {
|
||
scope.mdlTimepicker = hour + ':' + min + ':' + sec;
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
dialog.hide();
|
||
} else {
|
||
if (scope.$root.showAlert)
|
||
scope.$root.showAlert($filter('translate')('common.msg.time_format_error'));
|
||
}
|
||
},
|
||
function (dialog) {
|
||
angular.element(element[0]).removeClass('is-focus');
|
||
dialog.hide();
|
||
}, options);
|
||
});
|
||
scope.$watch('mdlTimepicker', function (newVals) {
|
||
if(newVals == undefined)
|
||
element[0].value = '';
|
||
else
|
||
element[0].value = newVals;
|
||
});
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}]);
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
angular
|
||
.module('material.components.barcode', [])
|
||
.provider('$mdlBarcode', function () {
|
||
this.$get = ['$interval', '$rootScope', '$mdDialog', function ($interval, $rootScope, $mdDialog) {
|
||
var _mdlBarcode = {
|
||
nowBarcodeId: '',
|
||
barcodes: {
|
||
},
|
||
_$interval: undefined,
|
||
Start: function ($elem) {
|
||
_mdlBarcode.nowBarcodeId = $elem.attr('id');
|
||
_mdlBarcode.barcodes[$elem.attr('id')] = $elem;
|
||
if (!_mdlBarcode._$interval) {
|
||
_mdlBarcode._$interval = $interval(function() {
|
||
if(!$mdDialog.isShow() && $rootScope.Loading.disabled) {
|
||
if (document.activeElement.id != _mdlBarcode.barcodes[_mdlBarcode.nowBarcodeId].attr('id')) {
|
||
//當目前focus 對象不為本物件時才要進行判斷
|
||
if (document.activeElement.tagName != 'INPUT' && document.activeElement.tagName != 'TEXTAREA') {
|
||
_mdlBarcode.barcodes[_mdlBarcode.nowBarcodeId].focus();
|
||
} else if (document.activeElement.getAttribute('readonly') == 'readonly') {
|
||
_mdlBarcode.barcodes[_mdlBarcode.nowBarcodeId].focus();
|
||
}
|
||
}
|
||
} else {
|
||
_mdlBarcode.barcodes[_mdlBarcode.nowBarcodeId].blur();
|
||
}
|
||
}, 200);
|
||
}
|
||
},
|
||
Stop: function ($elem) {
|
||
delete _mdlBarcode.barcodes[$elem.attr('id')];
|
||
if (Object.keys(_mdlBarcode.barcodes).length == 0) {
|
||
$interval.cancel(_mdlBarcode._$interval);
|
||
_mdlBarcode.nowBarcodeId = '';
|
||
_mdlBarcode._$interval = undefined;
|
||
} else {
|
||
_mdlBarcode.nowBarcodeId = Object.keys(_mdlBarcode)[Object.keys(_mdlBarcode).length - 1];
|
||
}
|
||
}
|
||
}
|
||
return _mdlBarcode;
|
||
}];
|
||
})
|
||
.directive('mdlBarcode', function ($mdlBarcode, $rootScope, $mdDialog, $timeout, $interval) {
|
||
function compile(tElem, tAttrs) {
|
||
if(window.cordova)
|
||
tAttrs.$set('readonly', 'readonly');
|
||
|
||
tElem.addClass('mdl-barcode');
|
||
tAttrs.$set('id', new Date().getTime() + '-' + Math.random());
|
||
return {
|
||
post: function ($scope, $elem, $attr) {
|
||
$mdlBarcode.Start($elem);
|
||
$elem.bind('keypress', function (event) {
|
||
if(event != undefined && event.keyCode == 13) {
|
||
var _barcode = event.target.value;
|
||
event.target.blur();
|
||
event.target.value = '';
|
||
// _barcode 即是刷入的序號,請在此之後進行處理
|
||
$timeout(function() {
|
||
//$rootScope.showLoading(_target.value);
|
||
$scope.onComplete({ barcode: _barcode });
|
||
});
|
||
|
||
} else if (window.cordova) {
|
||
if (event.key) {
|
||
event.target.value += event.key;
|
||
} else {
|
||
event.target.value += String.fromCharCode(event.keyCode);
|
||
}
|
||
}
|
||
});
|
||
$elem.bind('focus', function (event) {
|
||
$mdlBarcode.nowBarcodeId = event.target.id;
|
||
});
|
||
$scope.$on('$destroy', function () {
|
||
$mdlBarcode.Stop($elem);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
onComplete: '&mdlBarcode'
|
||
},
|
||
compile: compile
|
||
}
|
||
});
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
angular
|
||
.module('material.components.dashboard', [])
|
||
.directive('mdlDashboard', function () {
|
||
var config = {
|
||
};
|
||
var defualt_config = {
|
||
radius: 48, //圓環半徑
|
||
innerRadiusRate: 0.7, //圓環的比例
|
||
startAngle: -80, //起始的角度
|
||
endAngle: 80, //結束的角度
|
||
padding_top: 16, //上方的padding
|
||
padding_left: 28, //兩邊的padding
|
||
limit_font_size: 10, //邊界值字體大小
|
||
value_font_size: 20, //目前數值字體大小
|
||
line_width: 6, //指針寬度
|
||
colorType: []//綠黃紅
|
||
};
|
||
var pie, arc, arcs;
|
||
|
||
function prepareDatas(data) {
|
||
var datas = [];
|
||
config.colorType = [];
|
||
//if(data.guideline_max && data.guideline_max!=''){
|
||
//datas.push({label:data.guideline_min, value:1});
|
||
//datas.push({label:'', value:0});//紅色
|
||
if (data.min_spec !== null) {
|
||
datas.push({ label: data.min_spec, value: 1 });//紅色
|
||
config.colorType.push('#db4b3c');
|
||
} else {
|
||
datas.push({ label: '', value: 1 });//黃色
|
||
config.colorType.push('#f6cf5a');
|
||
}
|
||
|
||
if (data.min_warn !== null) {
|
||
datas.push({ label: '', value: 1 });//黃色
|
||
config.colorType.push('#f6cf5a');
|
||
} else {
|
||
datas.push({ label: '', value: 1 });//綠色
|
||
config.colorType.push('#68bd84');
|
||
if (data.min_spec === null) {
|
||
config.colorType[0] = '#68bd84';
|
||
}
|
||
}
|
||
|
||
datas.push({ label: data.stardard_value, value: 1 });//綠
|
||
config.colorType.push('#68bd84');
|
||
datas.push({ label: '', value: 1 });//綠
|
||
config.colorType.push('#68bd84');
|
||
|
||
if (data.max_warn !== null) {
|
||
if (data.max_spec == null)
|
||
datas.push({ label: '', value: 1 });//黃
|
||
else
|
||
datas.push({ label: data.max_spec, value: 1 });//黃
|
||
config.colorType.push('#f6cf5a');
|
||
} else {
|
||
if (data.max_spec == null)
|
||
datas.push({ label: '', value: 1 });//黃
|
||
else
|
||
datas.push({ label: data.max_spec, value: 1 });//黃
|
||
config.colorType.push('#68bd84');
|
||
}
|
||
if (data.max_spec !== null) {
|
||
datas.push({ label: '', value: 1 });//紅色
|
||
config.colorType.push('#db4b3c');
|
||
} else {
|
||
datas.push({ label: '', value: 1 });//紅色
|
||
//如果上限不存在則延續上一個的顏色
|
||
config.colorType.push(config.colorType[config.colorType.length - 1]);
|
||
}
|
||
|
||
//} else {
|
||
// datas.push({label:'', value:100});
|
||
//}
|
||
|
||
return datas;
|
||
}
|
||
|
||
function prepareHtml(element) {
|
||
d3.select(element[0]).selectAll('div').remove();
|
||
d3.select(element[0]).attr('class', 'mdl-dashboard');
|
||
d3.select(element[0]).append('div').attr('class', 'mdl-dashboard-cicle');
|
||
d3.select(element[0]).append('div').attr('class', 'mdl-dashboard-bottom');
|
||
// d3.select(element[0]).append('div').attr('class', 'mdl-dashboard-label');
|
||
|
||
return element;
|
||
}
|
||
|
||
function calcValueDeg(data) {
|
||
var deg = 0, max = null, min = null;
|
||
if (data.max_warn !== '') {
|
||
max = data.max_warn;
|
||
} else if (data.max_spec !== null) {
|
||
max = data.max_spec;
|
||
}
|
||
if (data.min_warn !== null) {
|
||
min = data.min_warn;
|
||
} else if (data.min_spec !== null) {
|
||
min = data.min_spec;
|
||
}
|
||
|
||
if (data.min_spec !== null && data.param_value < (+data.min_spec)) {
|
||
deg = (1 / 12) * (config.endAngle - config.startAngle);
|
||
} else if (data.max_spec !== null && data.param_value > (+data.max_spec)) {
|
||
deg = (1 - 1 / 12) * (config.endAngle - config.startAngle);
|
||
} else if (data.min_warn !== null && data.param_value < (+data.min_warn)) {
|
||
deg = (3 / 12) * (config.endAngle - config.startAngle);
|
||
} else if (data.max_warn !== null && data.param_value > (+data.max_warn)) {
|
||
deg = (1 - 3 / 12) * (config.endAngle - config.startAngle);
|
||
} else if (min !== null && max !== null) {
|
||
var _temp = ((+data.param_value) - (+min)) / ((+max) - (+min));
|
||
deg = ((2 * _temp + 2) / 6) * (config.endAngle - config.startAngle);
|
||
} else {
|
||
deg = (config.endAngle - config.startAngle) / 2;
|
||
}
|
||
|
||
return deg;
|
||
}
|
||
|
||
function nowRangeColor(result) {
|
||
if(result == 'green') {
|
||
return '#68bd84';
|
||
} else if (result == 'yellow') {
|
||
return '#f6cf5a';
|
||
} else if (result == 'red') {
|
||
return '#db4b3c';
|
||
}
|
||
}
|
||
/*
|
||
function checkWarn(data){
|
||
if(data.guideline_max && data.guideline_max!=''){
|
||
if(data.guideline_mode == '1'){
|
||
if((+data.guideline_2) <= (+data.param_value))
|
||
//return 'is-warn';
|
||
data.isWarn = true;
|
||
} else if(data.guideline_mode == '2'){
|
||
if((+data.guideline_1) >= (+data.param_value))
|
||
//return 'is-warn';
|
||
data.isWarn = true;
|
||
} else if(data.guideline_mode == '3'){
|
||
if((+data.guideline_2) <= (+data.param_value)||
|
||
(+data.guideline_1) >= (+data.param_value)){
|
||
//return 'is-warn';
|
||
data.isWarn = true;
|
||
}
|
||
}
|
||
}
|
||
return data;
|
||
}*/
|
||
function initDashboard(element, data) {
|
||
data.param_value = new Number(data.param_value);
|
||
element = prepareHtml(element);
|
||
var circle = d3.select(element[0]).select('.mdl-dashboard-cicle');
|
||
var pi = pi = Math.PI;
|
||
//var datas = prepareDatas(checkWarn(data)); //產生出d3.js 能讀取的資料集合
|
||
var datas = prepareDatas(data); //產生出d3.js 能讀取的資料集合
|
||
var valueDeg = calcValueDeg(data); //算出目前的度數
|
||
var color = d3.scaleOrdinal(config.colorType);
|
||
|
||
//清空directive下的svg
|
||
d3.select(element[0]).selectAll('svg').remove();
|
||
//建立SVG
|
||
var vis = circle.append('svg').attr('width', config.radius * 2 + config.padding_left * 2).attr('height', config.radius + config.padding_top + 5)//設定長寬
|
||
//建立G節點
|
||
.append('svg:g').attr('transform', 'translate(' + (config.radius + config.padding_left) + ',' + (config.radius + config.padding_top) + ')');
|
||
|
||
//設定圓的內外徑
|
||
arc = d3.arc()
|
||
.outerRadius(config.radius)
|
||
//.outerRadius(config.radius*(1-(config.innerRadiusRate/2)))
|
||
.innerRadius(config.radius * config.innerRadiusRate);
|
||
//.innerRadius(config.radius*(1-(config.innerRadiusRate/2)));
|
||
|
||
|
||
pie = d3.pie().value(function(d) { return d.value; })
|
||
.startAngle(config.startAngle * (pi / 180)).endAngle(config.endAngle * (pi / 180))//設定起始/結束角度
|
||
.sort(null); //取消排序
|
||
|
||
//產生扇型態
|
||
arcs = vis.data([datas])
|
||
.selectAll('g.slice').data(pie).enter()//for 迴圈
|
||
.append('svg:g').attr('class', 'slice');
|
||
arcs.append('svg:path')
|
||
.attr('fill', function (d, i) { return color(i); })
|
||
//.attr('fill', '#ffffff' )
|
||
//.attr('stroke', '#eeeeee')
|
||
//.attr('stroke-dasharray','2,4')
|
||
//.attr('stroke-width', 2)
|
||
.attr('d', arc);
|
||
|
||
arcs.append('text').attr('transform', function (d) {
|
||
var x = Math.sin(d.endAngle) * (config.radius + 4);
|
||
var y = 0 - Math.cos(d.endAngle) * (config.radius + 4);
|
||
return 'translate(' + x + ',' + y + ')';
|
||
})
|
||
.style('font-size', config.limit_font_size + 'px')
|
||
.attr('text-anchor', function (d, i) {
|
||
//console.log(i);
|
||
if(datas.length / 2 == (i + 1)) {
|
||
return 'middle';
|
||
} else if (d.endAngle < 0) {
|
||
return 'end';
|
||
} else {
|
||
return 'start';
|
||
}
|
||
})
|
||
.text(function(d, i) {
|
||
return datas[i].label != '' ? new Number(datas[i].label) : datas[i].label;
|
||
});
|
||
|
||
//指針
|
||
/*
|
||
circle.selectAll('svg').append('line').attr('class', 'pointer')
|
||
.attr('x1', config.padding_left-2).attr('y1', config.radius+config.padding_top)//起
|
||
.attr('x2', config.padding_left + (config.radius*(1-config.innerRadiusRate)) + 2).attr('y2', config.radius+config.padding_top)//迄
|
||
.style('stroke', 'black').style('stroke-width', config.line_width)
|
||
*/
|
||
//var right = config.radius*(1-config.innerRadiusRate);
|
||
var right = config.radius - (config.value_font_size);
|
||
circle.selectAll('svg').append('polygon')
|
||
.attr(
|
||
'points', (config.padding_left + 2) + ',' + (config.radius + config.padding_top) //左
|
||
+ ' ' + (config.padding_left + right + 4) + ',' + (config.radius + config.padding_top - (config.line_width / 2)) //上
|
||
+ ' ' + (config.padding_left + right + 8) + ',' + (config.radius + config.padding_top) //右
|
||
+ ' ' + (config.padding_left + right + 4) + ',' + (config.radius + config.padding_top + (config.line_width / 2)) //下
|
||
)
|
||
.attr('class', 'pointer')
|
||
.style('fill', '#000000')
|
||
.style('transform-origin', config.radius + config.padding_left + 'px ' + (config.radius + config.padding_top) + 'px')
|
||
.style('transform', 'rotate(' + (valueDeg + 90 + config.startAngle) + 'deg)');
|
||
//目前數值
|
||
circle.selectAll('svg').append('text').attr('class', 'pointer-value')
|
||
.attr('transform', 'translate(' + (config.radius + config.padding_left) + ', ' + (config.radius + config.padding_top) + ')')
|
||
.style('font-size', config.value_font_size + 'px')
|
||
.style('font-weight', '600')
|
||
.attr('text-anchor', 'middle')
|
||
.style('text-shadow', '0px 0px 10px #fff, 0px 0px 10px #fff, 0px 0px 10px #fff, 0px 0px 10px #fff, 0px 0px 10px #fff, 0px 0px 10px #fff, 0px 0px 10px #fff')
|
||
.text(new Number(data.param_value));
|
||
//label
|
||
d3.select(element[0]).select('.mdl-dashboard-bottom').style('background', nowRangeColor(data.param_result)).text(data.param_name);
|
||
d3.select(element[0]).classed('is-warn', (data.need_alert == 'Y'));
|
||
}
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
'datas': '=',
|
||
'config': '='
|
||
},
|
||
link: function (scope, element, attrs) {
|
||
angular.extend(config, defualt_config);
|
||
if (scope.config)
|
||
angular.extend(config, scope.config);
|
||
scope.$watch('datas', function (newVals, oldVals) {
|
||
initDashboard(element, newVals); //繪圖初始化
|
||
}, true);
|
||
}
|
||
};
|
||
})
|
||
.directive('mdlPiechart', function () {
|
||
var config = {
|
||
radius: 50,
|
||
innerRadiusRate: 0,
|
||
padding: 10,
|
||
colorType: {
|
||
'1': ['black', 'green', 'yellow', 'red'],//綠黃紅
|
||
'2': ['black', 'red', 'yellow', 'green'],//紅黃綠
|
||
'3': ['black', 'red', 'green', 'red']//紅綠紅
|
||
},
|
||
isShowLabel: true
|
||
};
|
||
|
||
var pie, arc, arcs;
|
||
|
||
function prepareColor(datas) {
|
||
var colors = [];
|
||
datas.forEach(function(data) {
|
||
colors.push(data.color);
|
||
});
|
||
return colors;
|
||
}
|
||
|
||
function initPiechart(element, data) {
|
||
d3.select(element[0]).attr('class', 'mdl-piechart');
|
||
|
||
var pi = Math.PI;
|
||
var color = d3.scaleOrdinal(prepareColor(data));
|
||
|
||
//清空directive下的svg
|
||
d3.select(element[0]).selectAll('svg').remove();
|
||
var vis = d3.select(element[0]).append('svg').data([data])//設定資料
|
||
.attr('width', config.radius * 2 + config.padding * 2).attr('height', config.radius * 2 + config.padding * 2)//設定長寬
|
||
.append('svg:g').attr('transform', 'translate(' + (config.radius + config.padding) + ',' + (config.radius + config.padding) + ')');
|
||
arc = d3.arc().outerRadius(function(d, i) {
|
||
var padding = d.data.focus ? 6 : 0;
|
||
return config.radius + padding;
|
||
})
|
||
.innerRadius(config.radius * config.innerRadiusRate);
|
||
/*
|
||
.innerRadius(function(d, i) {
|
||
var padding = d.data.focus?4:0;
|
||
return (config.radius*config.innerRadiusRate) + padding;
|
||
});
|
||
*/
|
||
pie = d3.pie().value(function(d) { return d.value; })
|
||
.sort(null); //取消排序
|
||
|
||
arcs = vis.selectAll('g.slice').data(pie).enter().append('svg:g').attr('class', 'slice');
|
||
arcs.append('svg:path').attr('fill', function (d, i) { return color(i); }).attr('d', arc)
|
||
if (config.isShowLabel) {
|
||
arcs.append('text').attr('transform', function (d) {
|
||
var angle = (d.endAngle - d.startAngle) / 2 + d.startAngle;
|
||
var x = Math.sin(angle) * (config.radius + 20);
|
||
var y = 0 - Math.cos(angle) * (config.radius + 20) + 6;
|
||
return 'translate(' + x + ',' + y + ')';
|
||
})
|
||
.style('font-size', '12px')
|
||
.attr('text-anchor', 'middle')
|
||
.text(function(d, i) { return data[i].label; });
|
||
}
|
||
}
|
||
|
||
return {
|
||
restrict: 'A',
|
||
scope: {
|
||
config: '=', //設定
|
||
datas: '=' //雙向data binding
|
||
},
|
||
link: function (scope, element, attrs) {
|
||
config.radius = new Number(attrs.chartRadius);
|
||
config.isShowLabel = attrs.isShowLabel == 'true';
|
||
|
||
if (scope.config)
|
||
angular.extend(config, scope.config);
|
||
scope.$watch('datas', function (newVals, oldVals) {
|
||
initPiechart(element, newVals); //繪圖初始化
|
||
}, true);
|
||
}
|
||
};
|
||
});
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
var kmilistSeq = 0,
|
||
module = angular
|
||
.module('material.components.list', [])
|
||
.directive('kmiList', ['$parse', '$mdDialog', '$filter', '$state', '$window', function ($parse, $mdDialog, $filter, $state, $window) {
|
||
var temp = { },
|
||
sheetTemplate = '<style type="text/css"></style>',
|
||
splitTemplate = '<div class="kmi-list__column-split"><div></div></div>',
|
||
buttonTemplate = '<div class="kmi-list__column width-fixed btn-selector"><i class="material-icons"></i></div>';
|
||
|
||
//更新列表及欄位長度
|
||
function columnResizing(event) {
|
||
//temp.diff = event.pageX-temp.x;
|
||
var diff = 0;
|
||
if (window.cordova)
|
||
diff = event.touches[0].pageX - temp.x;
|
||
else
|
||
diff = event.pageX - temp.x;
|
||
|
||
var width = temp.width + diff;
|
||
if (width >= 0) {
|
||
temp.diff = diff;
|
||
if (window.cordova) {
|
||
temp.content.style.cssText = 'flex:0 0 ' + width + 'px !important;';
|
||
} else {
|
||
temp.cssRule.style.cssText = 'flex:0 0 ' + width + 'px !important;';
|
||
}
|
||
temp.contentCSSRule.style.cssText = 'min-width:' + (+ temp.content_width + diff) + 'px !important;';
|
||
}
|
||
}
|
||
|
||
function getColumnInfo(index, headerColumn, headerColumnSave) {
|
||
//一旦設定為ng-hide的隱藏欄位就不處理
|
||
if(headerColumn.className.indexOf('ng-hide') == - 1) {
|
||
var columnObject = {
|
||
index: index
|
||
};//紀錄標題資訊的物件
|
||
//顯示及順序
|
||
if (headerColumn.className.indexOf('require') != - 1) {
|
||
columnObject.disabled = true;
|
||
columnObject.isSelect = true;
|
||
} else {
|
||
columnObject.disabled = false;
|
||
if (headerColumnSave) {
|
||
columnObject.isSelect = headerColumnSave.isSelect;
|
||
} else if (headerColumn.className.indexOf('hide') != - 1) {
|
||
columnObject.isSelect = false;
|
||
} else {
|
||
columnObject.isSelect = true;
|
||
}
|
||
}
|
||
if (headerColumn.className.indexOf('width-fixed') != - 1) {
|
||
columnObject.widthFixed = true;
|
||
} else {
|
||
columnObject.widthFixed = false;
|
||
}
|
||
if (headerColumnSave) {
|
||
columnObject.order = headerColumnSave.order;
|
||
if (headerColumnSave.width !== null)
|
||
columnObject.width = headerColumnSave.width;
|
||
else
|
||
columnObject.width = headerColumn.offsetWidth;
|
||
} else {
|
||
var order = headerColumn.getAttribute('order');
|
||
if (order && order != '') {
|
||
columnObject.order = order;
|
||
} else {
|
||
columnObject.order = columnObject.index;
|
||
}
|
||
columnObject.width = headerColumn.offsetWidth;
|
||
}
|
||
//如果有設定最小寬度則不可小於最小寬度
|
||
var minWith = isNaN(+headerColumn.style.minWidth.replace('px'));
|
||
if (columnObject.width < minWith) {
|
||
columnObject.width = minWith;
|
||
}
|
||
//columnObject.width為0則不處理
|
||
if (columnObject.width == 0) {
|
||
columnObject.width = undefined;
|
||
}
|
||
return columnObject;
|
||
}
|
||
}
|
||
|
||
//根據header組出列表
|
||
function getColumnList(headerColumns, headerColumnList) {
|
||
for(var index = 0; index < headerColumns.length; index++) {
|
||
var headerColumn = headerColumns[index];
|
||
var columnObject = headerColumnList[index];
|
||
if (headerColumn.className.indexOf('ng-hide') == - 1) {
|
||
//取出標題資訊
|
||
if (headerColumn.className.indexOf('head-controls') != - 1) {
|
||
columnObject.display = $(headerColumn).find('label').html();
|
||
} else if (headerColumn.innerHTML.indexOf('<') == - 1) {
|
||
if (headerColumn.getAttribute('column-name')) {
|
||
columnObject.display = headerColumn.getAttribute('column-name');
|
||
} else if (headerColumn.innerHTML != '') {
|
||
columnObject.display = headerColumn.innerHTML;
|
||
} else {
|
||
columnObject.display = '#';
|
||
}
|
||
|
||
} else {
|
||
if (headerColumn.getAttribute('column-name')) {
|
||
columnObject.display = headerColumn.getAttribute('column-name');
|
||
} else {
|
||
columnObject.display = '#';
|
||
}
|
||
}
|
||
} else {
|
||
columnObject.display = '#';
|
||
columnObject.NotVisibility = true;//表示畫面上不可見
|
||
}
|
||
|
||
//20210927 13871,增加欄位隱藏的方式,前端html設定data-itemhide="true"
|
||
if (headerColumn && headerColumn.dataset && headerColumn.dataset.itemhide == 'true') {
|
||
columnObject.display = '#';
|
||
}
|
||
|
||
if (columnObject.display == '#') {
|
||
//columnObject.display = '';
|
||
columnObject.isHide = true;//不顯示
|
||
}
|
||
}
|
||
return $filter('orderBy')(headerColumnList, 'order');
|
||
}
|
||
|
||
//將資料從localStorage 取出
|
||
function loadColumnList(id) {
|
||
if(id != undefined)
|
||
return JSON.parse(localStorage.getItem(id));
|
||
else
|
||
return null;
|
||
}
|
||
|
||
//將資料存進localStorage
|
||
function saveColumnList(id, headerColumnList) {
|
||
if(id != undefined)
|
||
localStorage.setItem(id, JSON.stringify(headerColumnList));
|
||
else
|
||
return null;
|
||
}
|
||
|
||
//開啟header選單
|
||
function openColumnSelector(scope, sheet, headColumnList, callback) {
|
||
$mdDialog.dialog('JSplugins/angular-material-lite/template/checkList.tmp.html', function (dialog) {
|
||
return {
|
||
title: $filter('translate')('common.msg.plz_select'),
|
||
beforeShown: function () {
|
||
var checklist_position = '';
|
||
if (!window.cordova)
|
||
checklist_position = '#column-selector-list .ps-scrollbar-content';
|
||
else
|
||
checklist_position = '#column-selector-list';
|
||
|
||
sortablejs.create($(checklist_position)[0], {
|
||
ghostClass: 'ghost',
|
||
filter: '.undragable',
|
||
handle: '.mdl-check-list__icon',
|
||
onEnd: function (evt) {
|
||
var newIndex = evt.newIndex;
|
||
var oldIndex = evt.oldIndex;
|
||
var chooseItem = dialog.itemList.splice(oldIndex, 1)[0];
|
||
dialog.itemList.splice(newIndex, 0, chooseItem);
|
||
dialog.itemList.forEach(function(item, index) {
|
||
item.order = index + 1;
|
||
sheet.cssRules[(item.index * 2)].style.order = item.order;
|
||
});
|
||
scope.$apply();
|
||
}
|
||
});
|
||
},
|
||
order: 'order',
|
||
label: 'display',
|
||
code: 'display',
|
||
back: function () {
|
||
//setColumnSelectorStatus(attrs.columnSelectorId, dialog.itemList);
|
||
var temp = dialog.itemList;
|
||
dialog.hide();
|
||
if (callback)
|
||
callback(temp);
|
||
},
|
||
itemList: headColumnList,
|
||
itemClick: function (item, event) {
|
||
item.isSelect = !item.isSelect;
|
||
if (item.isSelect) {
|
||
sheet.cssRules[(item.index * 2)].style.display = '';
|
||
} else {
|
||
sheet.cssRules[(item.index * 2)].style.display = 'none';
|
||
}
|
||
|
||
},
|
||
confirm: function () {
|
||
dialog.hide();
|
||
},
|
||
isConfirm: true,
|
||
isDrag: true
|
||
};
|
||
});
|
||
}
|
||
|
||
function ScollbarPost($scope, $elem, $attr, update, isScrollbar, isColumnSelector) {
|
||
//if($attr.kmiScrollbar == undefined || $attr.kmiScrollbar == ''){
|
||
// $attr.kmiScrollbar = $elem[0].offsetWidth + 'px';
|
||
//}
|
||
if(isScrollbar) {
|
||
var jqWindow = angular.element($window);
|
||
$elem = $($elem[0]).css('overflow', 'hidden').css('position', 'relative');
|
||
var content = $elem.find('.kmiScrollbar-content');
|
||
if (isColumnSelector) {
|
||
if ($attr.kmiScrollbar == undefined || $attr.kmiScrollbar == '') {
|
||
$attr.kmiScrollbar = $elem[0].offsetWidth + 'px';
|
||
}
|
||
content.css('min-width', $attr.kmiScrollbar);
|
||
}
|
||
|
||
var rowContent = content.find('.kmi-list__row-content').css('overflow', 'hidden');
|
||
var container_y_offset_top = content.find('.kmi-list__header').length > 0 ? 38 : 0;
|
||
var options = {
|
||
'wheelPropagation': true, //If this option is true, when the scroll reaches the end of the side, mousewheel event will be propagated to parent element.
|
||
'minScrollbarLength': 10,
|
||
'container_y': rowContent,
|
||
'container_y_offset_top': container_y_offset_top
|
||
};
|
||
|
||
$scope.$evalAsync(function() {
|
||
$elem.perfectScrollbar(options);
|
||
var onScrollHandler = $parse($attr.onScroll);
|
||
$elem.scroll(function() {
|
||
var scrollTop = $elem.scrollTop();
|
||
var scrollHeight = $elem.prop('scrollHeight') - $elem.height();
|
||
$scope.$apply(function() {
|
||
onScrollHandler($scope, {
|
||
scrollTop: scrollTop,
|
||
scrollHeight: scrollHeight
|
||
});
|
||
});
|
||
});
|
||
});
|
||
|
||
// This is necessary when you don't watch anything with the scrollbar
|
||
$elem.bind('mouseenter', function () {
|
||
update('mouseenter');
|
||
});
|
||
|
||
// Possible future improvement - check the type here and use the appropriate watch for non-arrays
|
||
if ($attr.refreshOnChange) {
|
||
$scope.$watchCollection($attr.refreshOnChange, function () {
|
||
update();
|
||
});
|
||
}
|
||
|
||
//listent the child's size;
|
||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
|
||
var MutationObserverConfig = {
|
||
childList: true,
|
||
attributes: true,
|
||
characterData: false
|
||
};
|
||
var observer = new MutationObserver(function(mutations) {
|
||
update();
|
||
});
|
||
observer.observe($elem.find('.kmiScrollbar-content')[0], MutationObserverConfig);
|
||
if ($attr.refreshOnResize) {
|
||
jqWindow.on('resize', update);
|
||
}
|
||
|
||
$elem.bind('$destroy', function () {
|
||
jqWindow.off('resize', update);
|
||
$elem.perfectScrollbar('destroy');
|
||
});
|
||
} else {
|
||
$elem = $elem.css('overflow', 'auto');
|
||
if (window.cordova) {
|
||
if (isColumnSelector) {
|
||
if ($attr.kmiScrollbar == undefined || $attr.kmiScrollbar == '') {
|
||
$attr.kmiScrollbar = $elem[0].offsetWidth + 'px';
|
||
}
|
||
$elem.find('.kmi-list__header').css('min-width', $attr.kmiScrollbar);
|
||
//20190115 modify by Dustdusk for M#: 修正Andorid scrollbar
|
||
$elem.find('.kmi-list__row-content').css('min-width', $attr.kmiScrollbar).css('overflow', 'auto');
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function compile(tElem, tAttrs) {
|
||
var isColumnSelector = $(tElem).hasClass('column-selector'), //是否使用欄位調整功能
|
||
isColumnSplit = !$(tElem).hasClass('none-column-split'), //是否使用欄位寬度調整
|
||
isScrollbar = !$(tElem).hasClass('none-scrollbar') && !window.cordova, //是否使用客制的左右拖拉
|
||
hashCode = Date.now() + '' + kmilistSeq;//此list的hashcode註記
|
||
//var headerColumnList = [];
|
||
kmilistSeq++;
|
||
if (isScrollbar) {
|
||
tElem.html('<div class="kmiScrollbar-content">' + tElem.html() + '</div>');
|
||
}
|
||
//將list 加上上hashCode方便標記,並將其下全部的column加上標註
|
||
var row = $(tElem).addClass('list-' + hashCode).find('.kmi-list__row-content .kmi-list__row');
|
||
if (isColumnSelector || isColumnSplit) {
|
||
row.each(function(index, single_row) {
|
||
single_row = $(single_row);
|
||
var headerColumns = single_row.find('.kmi-list__column');
|
||
if (headerColumns && headerColumns.length > 0) {
|
||
headerColumns.each(function(index, content_column) {
|
||
$(content_column).addClass('column' + (index + 2));
|
||
});
|
||
if (isColumnSelector)
|
||
//single_row.append('<div class="kmi-list__column btn-selector column' + (headerColumns.length + 1) + '"></div>');
|
||
$(single_row[0].firstElementChild).before('<div class="kmi-list__column btn-selector column0"></div>');
|
||
}
|
||
});
|
||
}
|
||
return {
|
||
post: function (scope, element, attrs) {
|
||
var list_id = attrs.columnSelectorId ? $state.current.name + '_' + attrs.columnSelectorId : undefined,//取出list id;
|
||
content_width = 0, //list總寬度
|
||
style_text = '', //list css
|
||
headerColumnsSave = loadColumnList(list_id),
|
||
header = $(element).find('.kmi-list__header'),
|
||
headerColumns,
|
||
headerColumnList = [];
|
||
|
||
var columnResizeEnd = function (event) {
|
||
if(window.cordova) {
|
||
document.removeEventListener('touchmove', columnResizing);
|
||
document.removeEventListener('touchend', columnResizeEnd);
|
||
} else {
|
||
document.removeEventListener('mousemove', columnResizing);
|
||
document.removeEventListener('mouseup', columnResizeEnd);
|
||
}
|
||
if (window.cordova)
|
||
temp.cssRule.style.cssText = 'flex:0 0 ' + (temp.width + temp.diff) + 'px !important;';
|
||
headerColumnList[temp.index - 1].width = temp.width + temp.diff;
|
||
saveColumnList(list_id, headerColumnList);//儲存目前寬度
|
||
ScollbarUpdate();//更新Scrollbar
|
||
};
|
||
var ScollbarUpdate = function (event) {
|
||
if(!window.cordova) {
|
||
//更新Scollbar
|
||
scope.$evalAsync(function() {
|
||
if(attrs.scrollDown == 'true' && event != 'mouseenter') {
|
||
setTimeout(function() {
|
||
$(element).scrollTop($(element).prop('scrollHeight'));
|
||
}, 100);
|
||
}
|
||
$(element[0]).perfectScrollbar('update');
|
||
});
|
||
}
|
||
};
|
||
|
||
if (isColumnSelector) {
|
||
//右上角欄位選擇按鈕
|
||
($(header[0].firstElementChild).before($(buttonTemplate).click(function() {
|
||
var sheet = $(element).find('style')[0].sheet;
|
||
openColumnSelector(scope, sheet, getColumnList(headerColumns, headerColumnList), function (itemList) {
|
||
var real_width = 4;//padding的大小
|
||
itemList.forEach(function(item, index) {
|
||
if(item.isSelect && !item.NotVisibility) {
|
||
var temp = $(headerColumns[item.index - 1]).removeClass('hide');
|
||
if (item.width) {
|
||
real_width += item.width;
|
||
} else {
|
||
real_width += temp[0].offsetWidth;
|
||
}
|
||
}
|
||
});
|
||
headerColumnList = $filter('orderBy')(itemList, 'index');
|
||
sheet.cssRules[0].style.cssText = 'min-width:' + real_width + 'px !important;';
|
||
saveColumnList(list_id, headerColumnList);
|
||
ScollbarUpdate();//更新Scrollbar
|
||
});
|
||
scope.$apply();
|
||
})));
|
||
}
|
||
ScollbarPost(scope, element, attrs, ScollbarUpdate, isScrollbar, isColumnSelector);
|
||
headerColumns = header.find('.kmi-list__column');
|
||
headerColumns.each(function(index, header_column) {
|
||
index = index + 1;
|
||
var column_class = 'column' + index,
|
||
cssText = '',
|
||
columnObject;
|
||
|
||
if (headerColumnsSave !== null && headerColumnsSave.length === headerColumns.length) {
|
||
columnObject = getColumnInfo(index, header_column, headerColumnsSave[index - 1]);//將html物件轉換成物件
|
||
} else {
|
||
columnObject = getColumnInfo(index, header_column);
|
||
}
|
||
if (columnObject) {
|
||
$(header_column).addClass(column_class);
|
||
headerColumnList.push(columnObject);
|
||
//split 用來調整長度的css
|
||
style_text += '.list-' + hashCode + ' .kmi-list__column.' + column_class;
|
||
if (isColumnSplit) {
|
||
//非行動裝置才有需要設定大小
|
||
if (columnObject.width != undefined)
|
||
style_text += '{flex:0 0 ' + columnObject.width + 'px !important; }';
|
||
else
|
||
style_text += '{}';
|
||
|
||
var header_columnSplit = $(splitTemplate).addClass(column_class).insertAfter(header_column).first().attr('index', index);
|
||
var event_name = window.cordova ? 'touchstart' : 'mousedown';
|
||
header_columnSplit[0].addEventListener(event_name, function (event) {
|
||
event.stopPropagation();
|
||
event.preventDefault();
|
||
if (!columnObject.widthFixed) {
|
||
var sheet = $(element).find('style')[0].sheet;
|
||
if (window.cordova)
|
||
temp.x = event.touches[0].pageX;
|
||
else
|
||
temp.x = event.pageX;
|
||
temp.index = $(this).attr('index');
|
||
temp.width = $(header_column).width();
|
||
temp.cssRule = sheet.cssRules[((index * 2) - 1)];
|
||
temp.content_width = 0;
|
||
temp.contentCSSRule = sheet.cssRules[0];
|
||
temp.content = header_column;
|
||
//一旦準備寬度就先算出全部的寬度並記錄
|
||
var i = headerColumnList.length;
|
||
while (i--) {
|
||
var item = headerColumnList[i],
|
||
dom_item = headerColumns[item.index - 1];
|
||
if (item.width == undefined) {
|
||
item.width = dom_item.offsetWidth;
|
||
sheet.cssRules[((item.index * 2) - 1)].style.cssText = 'flex:0 0 ' + item.width + 'px !important;';
|
||
}
|
||
if (item.isSelect && dom_item.className.indexOf('ng-hide') == - 1) {
|
||
temp.content_width += item.width;
|
||
}
|
||
}
|
||
if (!window.cordova) {
|
||
document.addEventListener('mousemove', columnResizing);
|
||
document.addEventListener('mouseup', columnResizeEnd);
|
||
} else {
|
||
document.addEventListener('touchmove', columnResizing);
|
||
document.addEventListener('touchend', columnResizeEnd);
|
||
}
|
||
}
|
||
});
|
||
|
||
//20180921 對ng-hide/ng-show 進行資料監控
|
||
var ngHide = angular.element(header_column).attr('ng-hide');
|
||
if (ngHide != undefined) {
|
||
scope.$watch(ngHide, function (newVals, oldVals) {
|
||
if(newVals)
|
||
header_columnSplit.hide();
|
||
else
|
||
header_columnSplit.show();
|
||
});
|
||
}
|
||
var ngShow = angular.element(header_column).attr('ng-show');
|
||
if (ngShow != undefined) {
|
||
scope.$watch(ngShow, function (newVals, oldVals) {
|
||
if(newVals)
|
||
header_columnSplit.show();
|
||
else
|
||
header_columnSplit.hide();
|
||
});
|
||
}
|
||
|
||
if (header_column.className.indexOf('width-fixed') != - 1) {
|
||
header_columnSplit.hide();
|
||
}
|
||
} else {
|
||
style_text += '{}';
|
||
}
|
||
//console.log(columnObject);
|
||
if (isColumnSelector) {
|
||
if (!columnObject.isSelect) {
|
||
cssText += 'display:none;';
|
||
} else if (columnObject.width != undefined) {
|
||
content_width += (+columnObject.width);
|
||
}
|
||
cssText += 'order:' + columnObject.order + ';';
|
||
}
|
||
}
|
||
|
||
//調整順序跟隱藏的css
|
||
style_text += '.list-' + hashCode + ' .kmi-list__column.' + column_class + ',.list-' + hashCode + ' .kmi-list__column-split.' + column_class + '{' + cssText + '}';
|
||
});
|
||
|
||
var content_style = '.list-' + hashCode + ' .kmiScrollbar-content' +
|
||
',.list-' + hashCode + ' .kmi-list__row-content' +
|
||
',.list-' + hashCode + ' .kmi-list__header';
|
||
//非行動裝置才有需要設定大小
|
||
if (content_width != 0) {
|
||
content_style += '{min-width:' + content_width + 'px !important;} ';
|
||
} else {
|
||
content_style += '{} ';
|
||
}
|
||
$(sheetTemplate).prependTo(element).html(content_style + style_text);//將該list 所屬的CSS放上去
|
||
}
|
||
};
|
||
}
|
||
|
||
return {
|
||
restrict: 'C',
|
||
priority: 999,
|
||
scope: true,
|
||
compile: compile
|
||
};
|
||
}]);
|
||
if (!window.cordova) {
|
||
module.directive('kmiListColumn', ['$parse', '$mdDialog', '$filter', function ($parse, $mdDialog, $filter) {
|
||
return {
|
||
restrict: 'C',
|
||
compile: function (tElem, tAttrs) {
|
||
return {
|
||
post: function ($scope, $elem, $attr) {
|
||
$elem.bind('mouseover', function () {
|
||
if($attr.tooltip) {
|
||
tooltip.html($attr.tooltip);
|
||
tooltip.css('display', 'block');
|
||
tooltip.css('top', $(this).offset().top + 30 + 'px');
|
||
tooltip.css('left', $(this).offset().left + 'px');
|
||
} else if (this.scrollWidth > this.clientWidth || this.scrollHeight > this.clientHeight) {
|
||
if (this.innerHTML.indexOf('<i') == '-1') {
|
||
tooltip.html(this.innerHTML);
|
||
tooltip.css('display', 'block');
|
||
tooltip.css('top', $(this).offset().top + 30 + 'px');
|
||
tooltip.css('left', $(this).offset().left + 'px');
|
||
}
|
||
}
|
||
$($elem[0]).parent().mouseover();
|
||
});
|
||
|
||
$elem.bind('mouseleave', function () {
|
||
if(tooltip.html != '') {
|
||
tooltip.html('');
|
||
tooltip.css('display', 'none');
|
||
}
|
||
$($elem[0]).parent().mouseleave();
|
||
});
|
||
|
||
if ($elem.css('z-index') != 1) {
|
||
$elem.css('z-index', 1);
|
||
$elem.bind('mousedown', function (event) {
|
||
$elem.css('pointer-events', 'none');
|
||
//console.log($(document.elementFromPoint(event.pageX, event.pageY)));
|
||
$(document.elementFromPoint(event.pageX, event.pageY)).mousedown();
|
||
$elem.css('pointer-events', 'auto');
|
||
});
|
||
|
||
$elem.bind('mouseup', function (event) {
|
||
$elem.css('pointer-events', 'none');
|
||
var target = $(document.elementFromPoint(event.pageX, event.pageY));
|
||
target.mouseup();
|
||
if (target.attr('ng-click')) {
|
||
target.click();
|
||
}
|
||
$elem.css('pointer-events', 'auto');
|
||
});
|
||
}
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}]);
|
||
angular.element(document.body).append('<div id="kmi-tooltip"></div>');
|
||
var tooltip = angular.element(document.getElementById('kmi-tooltip'));
|
||
tooltip.bind('mouseleave', function () {
|
||
this.innerHTML = '';
|
||
this.style.display = 'none';
|
||
});
|
||
}
|
||
})();
|
||
(function () {
|
||
'use strict';
|
||
angular
|
||
.module('material.components.toast', [])
|
||
.provider('$mdlToast', function () {
|
||
//level : warning/error
|
||
this.$get = ['$timeout', '$animate', '$filter', function ($timeout, $animate, $filter) {
|
||
var toastHTML = '';
|
||
toastHTML += '<div id="kmi-toast" class="toast-hide tool-hide stack-hide">';
|
||
toastHTML += ' <div id="toast-panel">';
|
||
toastHTML += ' <div class="main-panel">';
|
||
toastHTML += ' <div id="toast-msg"></div>';
|
||
toastHTML += ' <div id="toast-tool">';
|
||
toastHTML += ' <div id="error-info" class="toast-btn">';
|
||
toastHTML += ' <i class="material-icons open">report</i>';
|
||
toastHTML += ' <i class="material-icons close">clear</i>';
|
||
toastHTML += ' <div class="kmi-can-click"></div>';
|
||
toastHTML += ' </div>';
|
||
toastHTML += ' </div>';
|
||
toastHTML += ' </div>';
|
||
toastHTML += ' <div id="detail-panel" onclick="event.stopPropagation();">';
|
||
toastHTML += ' <div id="exception-info"></div>';
|
||
toastHTML += ' <p id="stack-trace"></p>';
|
||
toastHTML += ' </div>';
|
||
toastHTML += ' </div>';
|
||
toastHTML += '</div>';
|
||
|
||
angular.element(document.body).append(toastHTML);
|
||
var kmiToast = angular.element(document.getElementById('kmi-toast'));
|
||
var kmiToastMsg = angular.element(document.getElementById('toast-msg'));
|
||
var kmiToastPanel = angular.element(document.getElementById('toast-panel'));
|
||
|
||
var default_options = { delay: 5 },
|
||
hideToastTimer,
|
||
isHideToast = true,
|
||
hideEvent,
|
||
//hideStact = true,
|
||
hideToast = function ($event) {
|
||
kmiToastMsg.html('');
|
||
kmiToastPanel.attr('class', '').attr('style', '');
|
||
kmiToast.attr('class', 'toast-hide tool-hide stack-hide');
|
||
document.getElementById('stack-trace').innerHTML = '';
|
||
isHideToast = true;
|
||
if (hideEvent != undefined)
|
||
hideEvent();
|
||
|
||
//20181005 add by Dustdusk for M#: toast 點擊後直接觸發後面的元件
|
||
if ($event) {
|
||
try {
|
||
var target = document.elementFromPoint($event.pageX, $event.pageY);
|
||
target.focus();
|
||
target.click();
|
||
} catch (e) {
|
||
//prevent mobile exception
|
||
console.error(e);
|
||
}
|
||
}
|
||
};
|
||
kmiToast[0].addEventListener('click', function ($event) {
|
||
//if(hideStact)
|
||
hideToast($event);
|
||
});
|
||
/*
|
||
document.addEventListener('keypress', function($event){
|
||
if(!isHideToast)
|
||
hideToast($event);
|
||
});
|
||
*/
|
||
document.getElementById('error-info').addEventListener('click', function ($event) {
|
||
$event.stopPropagation();
|
||
if (kmiToast.hasClass('stack-hide')) {
|
||
kmiToast.removeClass('stack-hide');
|
||
//hideStact = false;
|
||
} else {
|
||
kmiToast.addClass('stack-hide');
|
||
//hideStact = true;
|
||
}
|
||
});
|
||
return {
|
||
show: function (msg, options) {
|
||
options = angular.extend(angular.extend({ }, default_options), options);
|
||
|
||
kmiToastMsg.html(msg);
|
||
kmiToastPanel.attr('class', options.level);//warning/error
|
||
if (options.error_detail != undefined) {
|
||
kmiToast.removeClass('tool-hide');
|
||
document.getElementById('exception-info').innerHTML = $filter('translate')('error.service_msg', options.error_detail)
|
||
document.getElementById('stack-trace').innerHTML = options.error_detail.StackTrace;
|
||
} else {
|
||
kmiToast.addClass('tool-hide');
|
||
}
|
||
|
||
//position
|
||
if (options.left != undefined)
|
||
kmiToastPanel.css('left', options.left);
|
||
|
||
if (options.top != undefined) {
|
||
kmiToastPanel.css('top', options.top);
|
||
kmiToastPanel.css('bottom', 'inherit');
|
||
}
|
||
|
||
if (options.right != undefined)
|
||
kmiToastPanel.css('right', options.right);
|
||
|
||
if (options.bottom != undefined)
|
||
kmiToastPanel.css('bottom', options.bottom);
|
||
|
||
if (typeof (options.callback) == 'function')
|
||
hideEvent = options.callback;
|
||
else
|
||
hideEvent = undefined;
|
||
|
||
//Show Toast
|
||
kmiToast.removeClass('toast-hide');
|
||
isHideToast = false;
|
||
if (hideToastTimer) {
|
||
$timeout.cancel(hideToastTimer);
|
||
hideToastTimer = undefined;
|
||
}
|
||
if (options.delay == - 1) {
|
||
kmiToast.addClass('toast-tooltip');
|
||
} else if (options.delay > 0) {
|
||
hideToastTimer = $timeout(hideToast, options.delay * 1000);
|
||
}
|
||
},
|
||
hide: hideToast,
|
||
isHide: function () {
|
||
return isHideToast;
|
||
},
|
||
setDefault: function (options) {
|
||
default_options = options;
|
||
}
|
||
};
|
||
}];
|
||
})
|
||
.directive('mdlToast', ['$mdlToast', function ($mdlToast) {
|
||
return {
|
||
restrict: 'A',
|
||
compile: function (tElem, tAttrs) {
|
||
return {
|
||
post: function ($scope, $elem, $attr) {
|
||
$elem.bind('mouseover', function () {
|
||
if($attr.mdlToast && $attr.mdlToast != '') {
|
||
$mdlToast.show($attr.mdlToast, {
|
||
delay: -1,
|
||
left: $(this).offset().left + 'px',
|
||
top: $(this).offset().top + 30 + 'px'
|
||
});
|
||
}
|
||
//$elem.parent().mouseover();
|
||
});
|
||
|
||
$elem.bind('mouseleave', function () {
|
||
if($attr.mdlToast && $attr.mdlToast != '') {
|
||
$mdlToast.hide();
|
||
}
|
||
//$elem.parent().mouseleave();
|
||
});
|
||
}
|
||
};
|
||
}
|
||
};
|
||
}]);
|
||
angular
|
||
.module('material.components.Marquee', [])
|
||
.provider('$mdlMarquee', function () {
|
||
this.$get = ['$timeout', function ($timeout) {
|
||
var kmiMarquee = angular.element('<div class="kmi-marquee marquee-hide"></div>').appendTo(document.body),
|
||
hideMarqueeTimer,
|
||
hideMarquee = function () {
|
||
kmiMarquee.html('');
|
||
kmiMarquee.attr('class', 'kmi-marquee marquee-hide');
|
||
};
|
||
return {
|
||
show: function (msg, options) {
|
||
if(hideMarqueeTimer) {
|
||
$timeout.cancel(hideMarqueeTimer);
|
||
hideMarqueeTimer = undefined;
|
||
}
|
||
var second = 15 + msg.length / 25 * 2;
|
||
kmiMarquee.html('<div class="marquee-msg" style="animation-duration:' + second + 's;">' + msg + '</div>');
|
||
//Show Toast
|
||
kmiMarquee.addClass(options.level);
|
||
kmiMarquee.removeClass('marquee-hide');
|
||
hideMarqueeTimer = $timeout(hideMarquee, options.delay * 1000);
|
||
},
|
||
hide: hideMarquee
|
||
};
|
||
}];
|
||
});
|
||
})();
|
||
})(window, window.angular, moment, d3, sortablejs); |