goods.basegoods.Index.js
94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
webpackJsonp([34],{
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $ = __webpack_require__(1),
common = __webpack_require__(2);
var ZeroClipboard = __webpack_require__(32);
ZeroClipboard.config({swfPath: "http://cdn.yoho.cn/yohobuy-portal/assets/images/ZeroClipboard.swf"});
__webpack_require__(54);
__webpack_require__(55);
var ENUM = {
status: {
toAuditNum: '待审核',
failAuditNum: '驳回',
passAuditNum: '通过',
all: '全部'
}, //全部
tips: {
"toAuditNum": 0,
"failAuditNum": 0,
"passAuditNum": 0,
"all": ""
},
statusStr: {
100: '待审核',
200: '通过',
300: '驳回',
}
}
// 审核状态枚举
var AuditEnum = {
status: {
toAuditNum: 100,
passAuditNum: 200,
failAuditNum: 300
}
}
// 年龄层枚举
var AgeLevelEnum = {
level: {
1: "成人",
2: "大童",
3: "小童",
'2|3': "大小童",
'3|2': "大小童"
}
}
// 性别
var GenderEnum = {
gender: {
1: "男",
2: "女",
3: "通用"
}
}
// 性别
//1可补货,2不可补货 3部分可补货
var ReplenishEnum = {
enum: {
1: "可补货",
2: "不可补货",
3: "部分可补货"
}
}
// 商品类型
var GoodsTypeEnum = {
type: {
1: "普通商品",
2: "赠品",
3: "虚拟商品",
4: "组合商品",
"": "未知类型"
}
}
var YNEnum = {
enum: {
"Y": "是",
"N": "否",
"B": "品牌设置"
}
}
var sellType = {
enum: {
"1": "经销",
"2": "代销",
"3": "JIT",
"4": "专营店代销入库",
"5": "专营店代销不入库",
"10": "保税经销",
"30": "一件代发"
}
}
/*下拉选择*/
new common.dropDown({
el: "#shopId",
ajax: "queryShopPass",
hash: true
});
new common.dropDown({
el: "#brandId",
ajax: "brand",
hash: true,
params:function(){
return {userLimitFlag:true};
}
});
new common.dropDown({
el: "#isOutLets",
ajax: ""
});
new common.dropDown({
el: "#isAdvance",
ajax: ""
});
new common.dropDown({
el: "#gender",
ajax: ""
});
var tabTree = new common.tabTree("#sort");
tabTree.init();
var t = new common.tab2({
el: "#basicTab",
active:2,
click: function() {
var columnname=t.options.columns[t.options.active].name;
g.options.columns[6].hidden = true;
g.options.columns[9].hidden = true; //隐藏【创建时间】
g.options.columns[10].hidden = true; //隐藏【创建人】
g.options.columns[11].hidden = true; //隐藏【驳回时间】
g.options.columns[12].hidden = true; //隐藏【原因】
g.options.columns[13].hidden = true; //隐藏【通过时间】
g.options.columns[14].hidden = true; //隐藏【通过人】
g.options.columns[15].hidden = true; //隐藏【状态】
g.options.columns[16].hidden = true; //隐藏【操作信息】
if (columnname == "all") {
g.options.columns[6].hidden = false;
g.options.columns[15].hidden = false; //显示【状态】
g.options.columns[16].hidden = false; //显示【操作信息】
$("#daochu").hide();
} else {
switch (columnname) {
case 'toAuditNum':
{ // 待审核
g.options.columns[9].hidden = false; //显示【创建时间】
g.options.columns[10].hidden = false; //显示【创建人】
}
$("#daochu").hide();
break;
case 'failAuditNum':
{ // 待审核
g.options.columns[11].hidden = false; //显示【驳回时间】
g.options.columns[12].hidden = false; //显示【原因】
}
$("#daochu").hide();
break;
case 'passAuditNum':
{ // 待审核
g.options.columns[6].hidden = false;
g.options.columns[13].hidden = false; //显示【通过时间】
g.options.columns[14].hidden = false; //显示【通过人】
}
$("#daochu").show();
break;
default:
{
}
$("#daochu").hide();
break;
}
}
g.init('/product/getBaseProductList');
},
columns: [{
name: "toAuditNum",
display: "待审核({toAuditNum})"
}, {
name: "failAuditNum",
display: "驳回({failAuditNum})"
}, {
name: "passAuditNum",
display: "通过({passAuditNum})"
}, {
name: "all",
display: "全部{all}"
}]
}).init(ENUM.tips);
var g = new common.grid({
el: '#basicTable',
usepagesize:true,
parms: function() {
var select = tabTree.getAddress();
var sellTypeArray = common.util.__input("isJit");
var goodsYearsArray = common.util.__input("goodsYears");
var goodsSeasonArray = common.util.__input("goodsSeason");
return {
productSkn: common.util.__input("productSkn"),
productSku: common.util.__input("productSku"),
productName: common.util.__input("productName"),
shopId: common.util.__input("shopId"),
brandId: common.util.__input("brandId"),
gender: common.util.__input("gender"),
name: common.util.__input("filter-name"),
sellTypeArray: sellTypeArray == null ? sellTypeArray : sellTypeArray.toString(),
isOutLets: common.util.__input("isOutLets"),
isAdvance: common.util.__input("isAdvance"),
isAuditing: AuditEnum.status[t.getData().name],
maxSortId: select[0] ? select[0].id : "",
middleSortId: select[1] ? select[1].id : "",
smallSortId: select[2] ? select[2].id : "",
sortId: select[3] ? select[3].id : "",
founderName: common.util.__input("founderName"),
factoryCode: common.util.__input("factoryCode"),
skuFactoryCode: common.util.__input("skuFactoryCode"),
appType: common.util.__input("appType"),
goodsYearsArray: goodsYearsArray == null ? goodsYearsArray : goodsYearsArray.toString(),
goodsSeasonArray: goodsSeasonArray == null ? goodsSeasonArray : goodsSeasonArray.toString(),
nationalCode: common.util.__input("nationalCode")
};
},
columns: [{
display: '',
type: 'checkbox'
}, {
display: "SKN",
render: function(item) {
var html = "<a class=\"btn btn-xs btn-success info-copy\" data-clipboard-text=\""+item.productSkn+"\" >"+item.productSkn+"</a>" ;
return html;
}
}, {
display: "商品信息",
render: function(item) {
var html = [];
var catgory = item.maxSortName;
if (item.smallSortName) {
catgory = item.smallSortName
} else if (item.middleSortName) {
catgory = item.middleSortName;
};
var sellTypeName = sellType.enum ? (sellType.enum[item.sellType] || '') : '';
// mod by xueyin: 优化,商品名称去掉链接,支持业务复制
//html.push('<p>名称:<a target="_blank" data-index="' + item.__index + '" href="/base/goods/info/' + item.productSkn + '/' + item.isAuditing + '" class="btn btn-info btn-xs edit-class-btn">' + item.productName + '</a>');
html.push("<p>名称:" + item.productName + "</p>");
html.push("<p>品牌:" + item.brandName + "</p>");
html.push("<p>品类:" + catgory + "</p>");
html.push("<p>店铺:" + item.shopName + "</p>");
html.push("<p>经营模式:" + sellTypeName + "</p>");
return html.join('');
}
},
{
display: "售价",
render: function(item) {
var html = [];
html.push("<p>吊牌价:" + item.retailPrice + "</p>");
html.push("<p>销售价:" + item.salesPrice + "</p>");
//待审核和驳回列表中只显示吊牌价和销售价,通过的列表中显示
if (item.isAuditing === 200) {
//html.push("<p>是否VIP:" + YNEnum.enum[item.isVip] + "</p>");
if(item.productPrice&&item.productPrice.returnCoinMoney){
html.push("<p>返yoho币金额:" + item.productPrice.returnCoinMoney + "</p>");
}else{
html.push("<p>返yoho币金额:0</p>");
}
}
return html.join('');
}
},
{
display: "年龄层/性别",
render: function(item) {
var html = [];
var ageLevel=common.config.__ageLevel(item.ageLevel|| '');
var gender = GenderEnum.gender[item.gender];
const ageLevelText = ageLevel ? ageLevel + " / " : ''
html.push("<p>" + ageLevelText + gender + "</p>");
return html.join('');
}
},
{
display: "是否预售",
render: function(item) {
var html = [];
//判断是否是预售商品
if (item.isAdvance === "Y") {
var formatted = "";
if (item.expectArrivalTime) {
var t = new Date(item.expectArrivalTime * 1000);
formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
}
if (item.isDepositAdvance === 'Y') {
html.push("<p>定金预售</p>");
} else {
html.push("<p>普通预售</p>");
}
if (item.isDepositAdvance === 'Y') {
html.push("<p>定金:"+item.deposit+"</p>");
}
html.push("<p>预计到货时间:" + formatted + "</p>");
} else {
var formatted = "";
if (item.expectShelfTime) {
var t = new Date(item.expectShelfTime * 1000);
formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
}
html.push("<p>否</p>");
}
return html.join('');
}
},
{
display: "是否BLK",
render: function(item) {
if (item.appType === 0) {
return "<p>有货</p>";
} else if (item.appType === 1) {
return "<p>BLK</p>";
}
}
},
{
display: "是否JIT",
render: function(item) {
if (item.isJit == "Y") {
return "<p>是</p>";
} else if (item.isJit == "N") {
return "<p>否</p>";
}
}
},
{
display: "奥莱",
render: function(item) {
if (item.isOutLets == "Y") {
return "<p>奥莱</p>";
} else if (item.isOutLets == "N") {
return "<p>否</p>";
} else if (item.isOutLets == "B") {
return "<p>品牌设置</p>";
}
}
},
{
display: "商品类别",
render: function(item) {
var type = GoodsTypeEnum.type[item.attribute] ? GoodsTypeEnum.type[item.attribute] : "未知类型";
return "<p>" + type + "</p>"
}
},
{
display: "其他",
render: function(item) {
var html = [];
var limited = (item.isLimited == "Y") ? "限量款" : "非限量款";
var limitedPurchase = (item.isLimitbuy == "Y") ? "限购" : "非限购";
var replenishment = item.isSupplied ? ReplenishEnum.enum[item.isSupplied] : "";
var gender = GenderEnum.gender[item.gender];
html.push("<p>" + limited + "</p>");
// html.push("<p>" + limitedPurchase + "</p>");
html.push("<p>" + replenishment + "</p>");
return html.join('');
}
},
// 9
{
display: "创建时间",
hidden: true,
render: function(item) {
var t = new Date(item.createTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
// 10
{
display: "创建人",
name: "founderName",
hidden: true,
},
// 11
{
display: "驳回时间",
hidden: true,
render: function(item) {
var t = new Date(item.auditFailTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
// 12
{
display: "原因",
hidden: true,
render: function(item) {
return "<p>" + common.util.__filterNull(item, 'rejectReason') + "</p>";
}
},
// 13
{
display: "通过时间",
hidden: true,
render: function(item) {
var t = new Date(item.auditPassTime * 1000);
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
return "<p>" + formatted + "</p>";
}
},
// 14
{
display: "通过人",
hidden: true,
render: function(item) {
return "<p>" + common.util.__filterNull(item, 'auditPassName') + "</p>";
}
},
// 15
{
display: "状态",
render: function(item) {
var status = ENUM.statusStr[item.isAuditing];
return "<p>" + status + "</p>";
}
},
// 16
{
display: "操作信息",
render: function(item) {
var html = "<p>创建信息:" + common.util.__filterNull(item, 'createOperateInfo') + "</p>";
html += "<p>修改信息:" + common.util.__filterNull(item, 'operateInfo') + "</p>";
return html;
}
},
{
display: "操作",
render: function(item) {
var html = [];
// add by xueyin: 仍然保留详情页链接
html.push('<a target="_blank" data-index="' + item.__index + '" href="/base/goods/info/' + item.productSkn + '/' + item.isAuditing + '" class="btn btn-info btn-xs edit-class-btn">查看</a>');
if (item.isAuditing != 100) {
html.push('<a target="_blank" data-index="' + item.__index + '" class="btn btn-info btn-xs edit-class-btn" href="/base/goods/update/' + item.productSkn + '/' + item.isAuditing + '">修改</a>');
}
if (item.isAuditing == 100) {
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-success btn-xs edit-class-btn apply-success">通过</a>');
html.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn operation btn-danger btn-xs edit-class-btn apply-back">驳回</a>');
} else {
}
return html.join('');
}
},
],
complete: function () {
new ZeroClipboard($(".info-copy"));
}
});
g.init('/product/getBaseProductList');
$(document).on('click', '.info-copy', function () {
common.util.__tip("SKN已复制,可贴粘", "success")
});
// 筛选
$(document).on('click', "#filter-btn", function() {
g.reload(1);
loadTab();
});
// 通过
var BllPass = {
toast: function(content, fn) {
var $this = $(this);
common.dialog.confirm("温馨提示", content, function() {
common.util.__disButton.call($this);
common.util.__ajax({
url: '/base/goods/pass',
data: fn()
}, function() {
g.reload();
loadTab();
});
});
}
}
// 驳回
var BllReject = {
toast: function(content, fn) {
var $this = $(this);
common.dialog.confirm("温馨提示", content, function() {
common.util.__disButton.call($this);
common.util.__ajax({
url: '/base/goods/reject',
data: fn()
}, function() {
g.reload();
loadTab();
});
});
}
}
// tab初始化
var loadTab = function() {
setTimeout(function() {
common.util.__ajax({
url: "/base/goods/ajax/auditCount",
data: g.options.parms()
}, function(res) {
var __dt = $.extend({}, ENUM.tips, res.data);
t.setData(__dt);
t.render(__dt);
}, true);
}, 400);
}
loadTab();
//单个通过
$(document).on("click", ".apply-success", function() {
var item = g.rows[$(this).data("index")];
var data = function() {
return {
productSknList: JSON.stringify([item.productSkn]),
};
}
BllPass.toast.call(this, "你确定审核通过吗?", data);
});
//单个驳回
$(document).on("click", ".apply-back", function() {
var item = g.rows[$(this).data("index")];
var data = function() {
var reason = $('#bohui').val();
if (reason === '' || $.trim(reason) === '') {
return "请填写驳回原因";
}
return {
productSknList: JSON.stringify([item.productSkn]),
rejectReason: reason
};
}
BllReject.toast.call(this, $("#template").html(), data);
});
//批量驳回
$(document).on("click", "#reject-btn", function() {
var count = 0,
selectedArr = g.selected,
len = selectedArr.length,
data = g.options.parms();
var filter=$(".wqt_all").prop("checked");
$.each(data, function(key, value) {
if (value && value != '' && key != 'size' && key != 'tab') {
count++;
}else{
delete data[key];
}
});
if ((count > 0&&filter) || len > 0) {
var productSknList=[];
if (len > 0) {
$.each(selectedArr, function(i, value) {
productSknList.push(value['productSkn']);
});
}
var result=function(){
var reason = $('#bohui').val();
if (reason === '' || $.trim(reason) === '') {
//common.util.__tip('请填写驳回原因', 'warning');
return '请填写驳回原因';
}
if(filter){
return {
targetStatus: 3,
rejectReason: reason,
pramStr:JSON.stringify(data)
};
}else{
return {
targetStatus: 3,
rejectReason: reason,
productSknList:JSON.stringify(productSknList)
};
}
}
BllReject.toast.call(this, $("#template").html(), result);
}else{
common.util.__tip('请选择导出商品的条件', 'warning');
return;
}
});
//批量通过
$(document).on("click", "#pass-btn", function() {
var count = 0,
selectedArr = g.selected,
len = selectedArr.length,
data = g.options.parms();
var filter=$(".wqt_all").prop("checked");
// alert(filter);
$.each(data, function(key, value) {
if (value && value != '' && key != 'size' && key != 'tab') {
count++;
}else{
delete data[key];
}
});
if ((count > 0&&filter) || len > 0) {
var productSknList=[];
if (len > 0) {
$.each(selectedArr, function(i, value) {
productSknList.push(value['productSkn']);
});
}
var result=function(){
if(filter){
return {
pramStr:JSON.stringify(data)
};
}else{
return{productSknList:JSON.stringify(productSknList)};
}
}
BllPass.toast.call(this, "确定要通过该申请吗?", result);
}else{
common.util.__tip('请选择导出商品的条件', 'warning');
return;
}
});
/*删除*/
$(document).on("click", ".delete-class-btn", function() {
var item = g.rows[$(this).data("index")];
console.log(item);
common.util.__ajax({
url: '/base/goods/ajax/delete',
data: {
productSkn: item.productSkn,
isAuditing: item.isAuditing
}
});
});
/*******************************************************************/
/*验证 hack*/
$("#productSkn").on("keyup", function() {
$(this).val($(this).val().replace(/\D/g, ''));
});
$("#basedaochu").click(function(){
var count = 0,
selectedArr = g.selected,
len = selectedArr.length,
data = g.options.parms();
data.isAuditing=200;
var filter=$(".wqt_all").prop("checked");
$.each(data, function(key, value) {
if (value && value != '' && key != 'size' && key != 'tab') {
count++;
}
});
if ((count > 0&&filter) || len > 0) {
var productSknList=[];
if (len > 0) {
$.each(selectedArr, function(i, value) {
productSknList.push(value['productSkn']);
});
}
var getResult=function(){
if(filter){
var result={};
for(var name in data){
if(data.hasOwnProperty(name)&&data[name]){
result[name]=data[name];
}
}
return result
}else{
return{productSknList:productSknList,isAuditing:200};
}
}
window.open("/ajax/down?queryConf=" + JSON.stringify(getResult()) + "&type=baseProduce");
}else{
common.util.__tip('请选择导出商品的条件', 'warning');
return;
}
});
$(function(){
//以下为初始配置参数,用户可自行配置,同时,可配置事件参数
$('#goodsYears').multiselect({
header: true,
height: 200,
minWidth: 200,
classes: '',
checkAllText: '选中全部',
uncheckAllText: '取消全选',
noneSelectedText: '请选择货品年',
selectedText: '# 选中',
selectedList: 24,
show: null,
hide: null,
autoOpen: false,
multiple: true,
position: {},
appendTo: "body",
menuWidth:null
});
$('#goodsSeason').multiselect({
header: true,
height: 150,
minWidth: 200,
classes: '',
checkAllText: '选中全部',
uncheckAllText: '取消全选',
noneSelectedText: '请选择货品季',
selectedText: '# 选中',
selectedList: 6,
show: null,
hide: null,
autoOpen: false,
multiple: true,
position: {},
appendTo: "body",
menuWidth:null
});
$('#isJit').multiselect({
header: true,
height: 80,
minWidth: 200,
classes: '',
checkAllText: '选中全部',
uncheckAllText: '取消全选',
noneSelectedText: '经营模式',
selectedText: '# 选中',
selectedList: 3,
show: null,
hide: null,
autoOpen: false,
multiple: true,
position: {},
appendTo: "body",
menuWidth:null
});
});
/***/ },
/***/ 32:
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*!
* ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
* Copyright (c) 2009-2014 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v2.2.0
*/
!function(a,b){"use strict";var c,d,e,f=a,g=f.document,h=f.navigator,i=f.setTimeout,j=f.clearTimeout,k=f.setInterval,l=f.clearInterval,m=f.getComputedStyle,n=f.encodeURIComponent,o=f.ActiveXObject,p=f.Error,q=f.Number.parseInt||f.parseInt,r=f.Number.parseFloat||f.parseFloat,s=f.Number.isNaN||f.isNaN,t=f.Date.now,u=f.Object.keys,v=f.Object.defineProperty,w=f.Object.prototype.hasOwnProperty,x=f.Array.prototype.slice,y=function(){var a=function(a){return a};if("function"==typeof f.wrap&&"function"==typeof f.unwrap)try{var b=g.createElement("div"),c=f.unwrap(b);1===b.nodeType&&c&&1===c.nodeType&&(a=f.unwrap)}catch(d){}return a}(),z=function(a){return x.call(a,0)},A=function(){var a,c,d,e,f,g,h=z(arguments),i=h[0]||{};for(a=1,c=h.length;c>a;a++)if(null!=(d=h[a]))for(e in d)w.call(d,e)&&(f=i[e],g=d[e],i!==g&&g!==b&&(i[e]=g));return i},B=function(a){var b,c,d,e;if("object"!=typeof a||null==a||"number"==typeof a.nodeType)b=a;else if("number"==typeof a.length)for(b=[],c=0,d=a.length;d>c;c++)w.call(a,c)&&(b[c]=B(a[c]));else{b={};for(e in a)w.call(a,e)&&(b[e]=B(a[e]))}return b},C=function(a,b){for(var c={},d=0,e=b.length;e>d;d++)b[d]in a&&(c[b[d]]=a[b[d]]);return c},D=function(a,b){var c={};for(var d in a)-1===b.indexOf(d)&&(c[d]=a[d]);return c},E=function(a){if(a)for(var b in a)w.call(a,b)&&delete a[b];return a},F=function(a,b){if(a&&1===a.nodeType&&a.ownerDocument&&b&&(1===b.nodeType&&b.ownerDocument&&b.ownerDocument===a.ownerDocument||9===b.nodeType&&!b.ownerDocument&&b===a.ownerDocument))do{if(a===b)return!0;a=a.parentNode}while(a);return!1},G=function(a){var b;return"string"==typeof a&&a&&(b=a.split("#")[0].split("?")[0],b=a.slice(0,a.lastIndexOf("/")+1)),b},H=function(a){var b,c;return"string"==typeof a&&a&&(c=a.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]?b=c[1]:(c=a.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]&&(b=c[1]))),b},I=function(){var a,b;try{throw new p}catch(c){b=c}return b&&(a=b.sourceURL||b.fileName||H(b.stack)),a},J=function(){var a,c,d;if(g.currentScript&&(a=g.currentScript.src))return a;if(c=g.getElementsByTagName("script"),1===c.length)return c[0].src||b;if("readyState"in c[0])for(d=c.length;d--;)if("interactive"===c[d].readyState&&(a=c[d].src))return a;return"loading"===g.readyState&&(a=c[c.length-1].src)?a:(a=I())?a:b},K=function(){var a,c,d,e=g.getElementsByTagName("script");for(a=e.length;a--;){if(!(d=e[a].src)){c=null;break}if(d=G(d),null==c)c=d;else if(c!==d){c=null;break}}return c||b},L=function(){var a=G(J())||K()||"";return a+"ZeroClipboard.swf"},M=function(){return null==a.opener&&(!!a.top&&a!=a.top||!!a.parent&&a!=a.parent)}(),N={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,sandboxed:null,unavailable:null,degraded:null,deactivated:null,overdue:null,ready:null},O="11.0.0",P={},Q={},R=null,S=0,T=0,U={ready:"Flash communication is established",error:{"flash-disabled":"Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.","flash-outdated":"Flash is too outdated to support ZeroClipboard","flash-sandboxed":"Attempting to run Flash in a sandboxed iframe, which is impossible","flash-unavailable":"Flash is unable to communicate bidirectionally with JavaScript","flash-degraded":"Flash is unable to preserve data fidelity when communicating with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate.\nThis may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity.\nMay also be attempting to run Flash in a sandboxed iframe, which is impossible.","flash-overdue":"Flash communication was established but NOT within the acceptable time limit","version-mismatch":"ZeroClipboard JS version number does not match ZeroClipboard SWF version number","clipboard-error":"At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard","config-mismatch":"ZeroClipboard configuration does not match Flash's reality","swf-not-found":"The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity"}},V=["flash-unavailable","flash-degraded","flash-overdue","version-mismatch","config-mismatch","clipboard-error"],W=["flash-disabled","flash-outdated","flash-sandboxed","flash-unavailable","flash-degraded","flash-deactivated","flash-overdue"],X=new RegExp("^flash-("+W.map(function(a){return a.replace(/^flash-/,"")}).join("|")+")$"),Y=new RegExp("^flash-("+W.slice(1).map(function(a){return a.replace(/^flash-/,"")}).join("|")+")$"),Z={swfPath:L(),trustedDomains:a.location.host?[a.location.host]:[],cacheBust:!0,forceEnhancedClipboard:!1,flashLoadTimeout:3e4,autoActivate:!0,bubbleEvents:!0,containerId:"global-zeroclipboard-html-bridge",containerClass:"global-zeroclipboard-container",swfObjectId:"global-zeroclipboard-flash-bridge",hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",forceHandCursor:!1,title:null,zIndex:999999999},$=function(a){if("object"==typeof a&&null!==a)for(var b in a)if(w.call(a,b))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(b))Z[b]=a[b];else if(null==N.bridge)if("containerId"===b||"swfObjectId"===b){if(!nb(a[b]))throw new Error("The specified `"+b+"` value is not valid as an HTML4 Element ID");Z[b]=a[b]}else Z[b]=a[b];{if("string"!=typeof a||!a)return B(Z);if(w.call(Z,a))return Z[a]}},_=function(){return Tb(),{browser:C(h,["userAgent","platform","appName"]),flash:D(N,["bridge"]),zeroclipboard:{version:Vb.version,config:Vb.config()}}},ab=function(){return!!(N.disabled||N.outdated||N.sandboxed||N.unavailable||N.degraded||N.deactivated)},bb=function(a,d){var e,f,g,h={};if("string"==typeof a&&a)g=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof d)for(e in a)w.call(a,e)&&"string"==typeof e&&e&&"function"==typeof a[e]&&Vb.on(e,a[e]);if(g&&g.length){for(e=0,f=g.length;f>e;e++)a=g[e].replace(/^on/,""),h[a]=!0,P[a]||(P[a]=[]),P[a].push(d);if(h.ready&&N.ready&&Vb.emit({type:"ready"}),h.error){for(e=0,f=W.length;f>e;e++)if(N[W[e].replace(/^flash-/,"")]===!0){Vb.emit({type:"error",name:W[e]});break}c!==b&&Vb.version!==c&&Vb.emit({type:"error",name:"version-mismatch",jsVersion:Vb.version,swfVersion:c})}}return Vb},cb=function(a,b){var c,d,e,f,g;if(0===arguments.length)f=u(P);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)w.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Vb.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=P[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return Vb},db=function(a){var b;return b="string"==typeof a&&a?B(P[a])||null:B(P)},eb=function(a){var b,c,d;return a=ob(a),a&&!vb(a)?"ready"===a.type&&N.overdue===!0?Vb.emit({type:"error",name:"flash-overdue"}):(b=A({},a),tb.call(this,b),"copy"===a.type&&(d=Db(Q),c=d.data,R=d.formatMap),c):void 0},fb=function(){var a=N.sandboxed;if(Tb(),"boolean"!=typeof N.ready&&(N.ready=!1),N.sandboxed!==a&&N.sandboxed===!0)N.ready=!1,Vb.emit({type:"error",name:"flash-sandboxed"});else if(!Vb.isFlashUnusable()&&null===N.bridge){var b=Z.flashLoadTimeout;"number"==typeof b&&b>=0&&(S=i(function(){"boolean"!=typeof N.deactivated&&(N.deactivated=!0),N.deactivated===!0&&Vb.emit({type:"error",name:"flash-deactivated"})},b)),N.overdue=!1,Bb()}},gb=function(){Vb.clearData(),Vb.blur(),Vb.emit("destroy"),Cb(),Vb.off()},hb=function(a,b){var c;if("object"==typeof a&&a&&"undefined"==typeof b)c=a,Vb.clearData();else{if("string"!=typeof a||!a)return;c={},c[a]=b}for(var d in c)"string"==typeof d&&d&&w.call(c,d)&&"string"==typeof c[d]&&c[d]&&(Q[d]=c[d])},ib=function(a){"undefined"==typeof a?(E(Q),R=null):"string"==typeof a&&w.call(Q,a)&&delete Q[a]},jb=function(a){return"undefined"==typeof a?B(Q):"string"==typeof a&&w.call(Q,a)?Q[a]:void 0},kb=function(a){if(a&&1===a.nodeType){d&&(Lb(d,Z.activeClass),d!==a&&Lb(d,Z.hoverClass)),d=a,Kb(a,Z.hoverClass);var b=a.getAttribute("title")||Z.title;if("string"==typeof b&&b){var c=Ab(N.bridge);c&&c.setAttribute("title",b)}var e=Z.forceHandCursor===!0||"pointer"===Mb(a,"cursor");Rb(e),Qb()}},lb=function(){var a=Ab(N.bridge);a&&(a.removeAttribute("title"),a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.height="1px"),d&&(Lb(d,Z.hoverClass),Lb(d,Z.activeClass),d=null)},mb=function(){return d||null},nb=function(a){return"string"==typeof a&&a&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(a)},ob=function(a){var b;if("string"==typeof a&&a?(b=a,a={}):"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(b=a.type),b){b=b.toLowerCase(),!a.target&&(/^(copy|aftercopy|_click)$/.test(b)||"error"===b&&"clipboard-error"===a.name)&&(a.target=e),A(a,{type:b,target:a.target||d||null,relatedTarget:a.relatedTarget||null,currentTarget:N&&N.bridge||null,timeStamp:a.timeStamp||t()||null});var c=U[a.type];return"error"===a.type&&a.name&&c&&(c=c[a.name]),c&&(a.message=c),"ready"===a.type&&A(a,{target:null,version:N.version}),"error"===a.type&&(X.test(a.name)&&A(a,{target:null,minimumVersion:O}),Y.test(a.name)&&A(a,{version:N.version})),"copy"===a.type&&(a.clipboardData={setData:Vb.setData,clearData:Vb.clearData}),"aftercopy"===a.type&&(a=Eb(a,R)),a.target&&!a.relatedTarget&&(a.relatedTarget=pb(a.target)),qb(a)}},pb=function(a){var b=a&&a.getAttribute&&a.getAttribute("data-clipboard-target");return b?g.getElementById(b):null},qb=function(a){if(a&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)){var c=a.target,d="_mouseover"===a.type&&a.relatedTarget?a.relatedTarget:b,e="_mouseout"===a.type&&a.relatedTarget?a.relatedTarget:b,h=Nb(c),i=f.screenLeft||f.screenX||0,j=f.screenTop||f.screenY||0,k=g.body.scrollLeft+g.documentElement.scrollLeft,l=g.body.scrollTop+g.documentElement.scrollTop,m=h.left+("number"==typeof a._stageX?a._stageX:0),n=h.top+("number"==typeof a._stageY?a._stageY:0),o=m-k,p=n-l,q=i+o,r=j+p,s="number"==typeof a.movementX?a.movementX:0,t="number"==typeof a.movementY?a.movementY:0;delete a._stageX,delete a._stageY,A(a,{srcElement:c,fromElement:d,toElement:e,screenX:q,screenY:r,pageX:m,pageY:n,clientX:o,clientY:p,x:o,y:p,movementX:s,movementY:t,offsetX:0,offsetY:0,layerX:0,layerY:0})}return a},rb=function(a){var b=a&&"string"==typeof a.type&&a.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(b)},sb=function(a,b,c,d){d?i(function(){a.apply(b,c)},0):a.apply(b,c)},tb=function(a){if("object"==typeof a&&a&&a.type){var b=rb(a),c=P["*"]||[],d=P[a.type]||[],e=c.concat(d);if(e&&e.length){var g,h,i,j,k,l=this;for(g=0,h=e.length;h>g;g++)i=e[g],j=l,"string"==typeof i&&"function"==typeof f[i]&&(i=f[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=A({},a),sb(i,j,[k],b))}return this}},ub=function(a){var b=null;return(M===!1||a&&"error"===a.type&&a.name&&-1!==V.indexOf(a.name))&&(b=!1),b},vb=function(a){var b=a.target||d||null,f="swf"===a._source;switch(delete a._source,a.type){case"error":var g="flash-sandboxed"===a.name||ub(a);"boolean"==typeof g&&(N.sandboxed=g),-1!==W.indexOf(a.name)?A(N,{disabled:"flash-disabled"===a.name,outdated:"flash-outdated"===a.name,unavailable:"flash-unavailable"===a.name,degraded:"flash-degraded"===a.name,deactivated:"flash-deactivated"===a.name,overdue:"flash-overdue"===a.name,ready:!1}):"version-mismatch"===a.name&&(c=a.swfVersion,A(N,{disabled:!1,outdated:!1,unavailable:!1,degraded:!1,deactivated:!1,overdue:!1,ready:!1})),Pb();break;case"ready":c=a.swfVersion;var h=N.deactivated===!0;A(N,{disabled:!1,outdated:!1,sandboxed:!1,unavailable:!1,degraded:!1,deactivated:!1,overdue:h,ready:!h}),Pb();break;case"beforecopy":e=b;break;case"copy":var i,j,k=a.relatedTarget;!Q["text/html"]&&!Q["text/plain"]&&k&&(j=k.value||k.outerHTML||k.innerHTML)&&(i=k.value||k.textContent||k.innerText)?(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",i),j!==i&&a.clipboardData.setData("text/html",j)):!Q["text/plain"]&&a.target&&(i=a.target.getAttribute("data-clipboard-text"))&&(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",i));break;case"aftercopy":wb(a),Vb.clearData(),b&&b!==Jb()&&b.focus&&b.focus();break;case"_mouseover":Vb.focus(b),Z.bubbleEvents===!0&&f&&(b&&b!==a.relatedTarget&&!F(a.relatedTarget,b)&&xb(A({},a,{type:"mouseenter",bubbles:!1,cancelable:!1})),xb(A({},a,{type:"mouseover"})));break;case"_mouseout":Vb.blur(),Z.bubbleEvents===!0&&f&&(b&&b!==a.relatedTarget&&!F(a.relatedTarget,b)&&xb(A({},a,{type:"mouseleave",bubbles:!1,cancelable:!1})),xb(A({},a,{type:"mouseout"})));break;case"_mousedown":Kb(b,Z.activeClass),Z.bubbleEvents===!0&&f&&xb(A({},a,{type:a.type.slice(1)}));break;case"_mouseup":Lb(b,Z.activeClass),Z.bubbleEvents===!0&&f&&xb(A({},a,{type:a.type.slice(1)}));break;case"_click":e=null,Z.bubbleEvents===!0&&f&&xb(A({},a,{type:a.type.slice(1)}));break;case"_mousemove":Z.bubbleEvents===!0&&f&&xb(A({},a,{type:a.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)?!0:void 0},wb=function(a){if(a.errors&&a.errors.length>0){var b=B(a);A(b,{type:"error",name:"clipboard-error"}),delete b.success,i(function(){Vb.emit(b)},0)}},xb=function(a){if(a&&"string"==typeof a.type&&a){var b,c=a.target||null,d=c&&c.ownerDocument||g,e={view:d.defaultView||f,canBubble:!0,cancelable:!0,detail:"click"===a.type?1:0,button:"number"==typeof a.which?a.which-1:"number"==typeof a.button?a.button:d.createEvent?0:1},h=A(e,a);c&&d.createEvent&&c.dispatchEvent&&(h=[h.type,h.canBubble,h.cancelable,h.view,h.detail,h.screenX,h.screenY,h.clientX,h.clientY,h.ctrlKey,h.altKey,h.shiftKey,h.metaKey,h.button,h.relatedTarget],b=d.createEvent("MouseEvents"),b.initMouseEvent&&(b.initMouseEvent.apply(b,h),b._source="js",c.dispatchEvent(b)))}},yb=function(){var a=Z.flashLoadTimeout;if("number"==typeof a&&a>=0){var b=Math.min(1e3,a/10),c=Z.swfObjectId+"_fallbackContent";T=k(function(){var a=g.getElementById(c);Ob(a)&&(Pb(),N.deactivated=null,Vb.emit({type:"error",name:"swf-not-found"}))},b)}},zb=function(){var a=g.createElement("div");return a.id=Z.containerId,a.className=Z.containerClass,a.style.position="absolute",a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.height="1px",a.style.zIndex=""+Sb(Z.zIndex),a},Ab=function(a){for(var b=a&&a.parentNode;b&&"OBJECT"===b.nodeName&&b.parentNode;)b=b.parentNode;return b||null},Bb=function(){var a,b=N.bridge,c=Ab(b);if(!b){var d=Ib(f.location.host,Z),e="never"===d?"none":"all",h=Gb(A({jsVersion:Vb.version},Z)),i=Z.swfPath+Fb(Z.swfPath,Z);c=zb();var j=g.createElement("div");c.appendChild(j),g.body.appendChild(c);var k=g.createElement("div"),l="activex"===N.pluginType;k.innerHTML='<object id="'+Z.swfObjectId+'" name="'+Z.swfObjectId+'" width="100%" height="100%" '+(l?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+i+'"')+">"+(l?'<param name="movie" value="'+i+'"/>':"")+'<param name="allowScriptAccess" value="'+d+'"/><param name="allowNetworking" value="'+e+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+h+'"/><div id="'+Z.swfObjectId+'_fallbackContent"> </div></object>',b=k.firstChild,k=null,y(b).ZeroClipboard=Vb,c.replaceChild(b,j),yb()}return b||(b=g[Z.swfObjectId],b&&(a=b.length)&&(b=b[a-1]),!b&&c&&(b=c.firstChild)),N.bridge=b||null,b},Cb=function(){var a=N.bridge;if(a){var d=Ab(a);d&&("activex"===N.pluginType&&"readyState"in a?(a.style.display="none",function e(){if(4===a.readyState){for(var b in a)"function"==typeof a[b]&&(a[b]=null);a.parentNode&&a.parentNode.removeChild(a),d.parentNode&&d.parentNode.removeChild(d)}else i(e,10)}()):(a.parentNode&&a.parentNode.removeChild(a),d.parentNode&&d.parentNode.removeChild(d))),Pb(),N.ready=null,N.bridge=null,N.deactivated=null,c=b}},Db=function(a){var b={},c={};if("object"==typeof a&&a){for(var d in a)if(d&&w.call(a,d)&&"string"==typeof a[d]&&a[d])switch(d.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":b.text=a[d],c.text=d;break;case"text/html":case"html":case"air:html":case"flash:html":b.html=a[d],c.html=d;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":b.rtf=a[d],c.rtf=d}return{data:b,formatMap:c}}},Eb=function(a,b){if("object"!=typeof a||!a||"object"!=typeof b||!b)return a;var c={};for(var d in a)if(w.call(a,d))if("errors"===d){c[d]=a[d]?a[d].slice():[];for(var e=0,f=c[d].length;f>e;e++)c[d][e].format=b[c[d][e].format]}else if("success"!==d&&"data"!==d)c[d]=a[d];else{c[d]={};var g=a[d];for(var h in g)h&&w.call(g,h)&&w.call(b,h)&&(c[d][b[h]]=g[h])}return c},Fb=function(a,b){var c=null==b||b&&b.cacheBust===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+t():""},Gb=function(a){var b,c,d,e,g="",h=[];if(a.trustedDomains&&("string"==typeof a.trustedDomains?e=[a.trustedDomains]:"object"==typeof a.trustedDomains&&"length"in a.trustedDomains&&(e=a.trustedDomains)),e&&e.length)for(b=0,c=e.length;c>b;b++)if(w.call(e,b)&&e[b]&&"string"==typeof e[b]){if(d=Hb(e[b]),!d)continue;if("*"===d){h.length=0,h.push(d);break}h.push.apply(h,[d,"//"+d,f.location.protocol+"//"+d])}return h.length&&(g+="trustedOrigins="+n(h.join(","))),a.forceEnhancedClipboard===!0&&(g+=(g?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof a.swfObjectId&&a.swfObjectId&&(g+=(g?"&":"")+"swfObjectId="+n(a.swfObjectId)),"string"==typeof a.jsVersion&&a.jsVersion&&(g+=(g?"&":"")+"jsVersion="+n(a.jsVersion)),g},Hb=function(a){if(null==a||""===a)return null;if(a=a.replace(/^\s+|\s+$/g,""),""===a)return null;var b=a.indexOf("//");a=-1===b?a:a.slice(b+2);var c=a.indexOf("/");return a=-1===c?a:-1===b||0===c?null:a.slice(0,c),a&&".swf"===a.slice(-4).toLowerCase()?null:a||null},Ib=function(){var a=function(a){var b,c,d,e=[];if("string"==typeof a&&(a=[a]),"object"!=typeof a||!a||"number"!=typeof a.length)return e;for(b=0,c=a.length;c>b;b++)if(w.call(a,b)&&(d=Hb(a[b]))){if("*"===d){e.length=0,e.push("*");break}-1===e.indexOf(d)&&e.push(d)}return e};return function(b,c){var d=Hb(c.swfPath);null===d&&(d=b);var e=a(c.trustedDomains),f=e.length;if(f>0){if(1===f&&"*"===e[0])return"always";if(-1!==e.indexOf(b))return 1===f&&b===d?"sameDomain":"always"}return"never"}}(),Jb=function(){try{return g.activeElement}catch(a){return null}},Kb=function(a,b){var c,d,e,f=[];if("string"==typeof b&&b&&(f=b.split(/\s+/)),a&&1===a.nodeType&&f.length>0)if(a.classList)for(c=0,d=f.length;d>c;c++)a.classList.add(f[c]);else if(a.hasOwnProperty("className")){for(e=" "+a.className+" ",c=0,d=f.length;d>c;c++)-1===e.indexOf(" "+f[c]+" ")&&(e+=f[c]+" ");a.className=e.replace(/^\s+|\s+$/g,"")}return a},Lb=function(a,b){var c,d,e,f=[];if("string"==typeof b&&b&&(f=b.split(/\s+/)),a&&1===a.nodeType&&f.length>0)if(a.classList&&a.classList.length>0)for(c=0,d=f.length;d>c;c++)a.classList.remove(f[c]);else if(a.className){for(e=(" "+a.className+" ").replace(/[\r\n\t]/g," "),c=0,d=f.length;d>c;c++)e=e.replace(" "+f[c]+" "," ");a.className=e.replace(/^\s+|\s+$/g,"")}return a},Mb=function(a,b){var c=m(a,null).getPropertyValue(b);return"cursor"!==b||c&&"auto"!==c||"A"!==a.nodeName?c:"pointer"},Nb=function(a){var b={left:0,top:0,width:0,height:0};if(a.getBoundingClientRect){var c=a.getBoundingClientRect(),d=f.pageXOffset,e=f.pageYOffset,h=g.documentElement.clientLeft||0,i=g.documentElement.clientTop||0,j=0,k=0;if("relative"===Mb(g.body,"position")){var l=g.body.getBoundingClientRect(),m=g.documentElement.getBoundingClientRect();j=l.left-m.left||0,k=l.top-m.top||0}b.left=c.left+d-h-j,b.top=c.top+e-i-k,b.width="width"in c?c.width:c.right-c.left,b.height="height"in c?c.height:c.bottom-c.top}return b},Ob=function(a){if(!a)return!1;var b=m(a,null),c=r(b.height)>0,d=r(b.width)>0,e=r(b.top)>=0,f=r(b.left)>=0,g=c&&d&&e&&f,h=g?null:Nb(a),i="none"!==b.display&&"collapse"!==b.visibility&&(g||!!h&&(c||h.height>0)&&(d||h.width>0)&&(e||h.top>=0)&&(f||h.left>=0));return i},Pb=function(){j(S),S=0,l(T),T=0},Qb=function(){var a;if(d&&(a=Ab(N.bridge))){var b=Nb(d);A(a.style,{width:b.width+"px",height:b.height+"px",top:b.top+"px",left:b.left+"px",zIndex:""+Sb(Z.zIndex)})}},Rb=function(a){N.ready===!0&&(N.bridge&&"function"==typeof N.bridge.setHandCursor?N.bridge.setHandCursor(a):N.ready=!1)},Sb=function(a){if(/^(?:auto|inherit)$/.test(a))return a;var b;return"number"!=typeof a||s(a)?"string"==typeof a&&(b=Sb(q(a,10))):b=a,"number"==typeof b?b:"auto"},Tb=function(b){var c,d,e,f=N.sandboxed,g=null;if(b=b===!0,M===!1)g=!1;else{try{d=a.frameElement||null}catch(h){e={name:h.name,message:h.message}}if(d&&1===d.nodeType&&"IFRAME"===d.nodeName)try{g=d.hasAttribute("sandbox")}catch(h){g=null}else{try{c=document.domain||null}catch(h){c=null}(null===c||e&&"SecurityError"===e.name&&/(^|[\s\(\[@])sandbox(es|ed|ing|[\s\.,!\)\]@]|$)/.test(e.message.toLowerCase()))&&(g=!0)}}return N.sandboxed=g,f===g||b||Ub(o),g},Ub=function(a){function b(a){var b=a.match(/[\d]+/g);return b.length=3,b.join(".")}function c(a){return!!a&&(a=a.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a)||"chrome.plugin"===a.slice(-13))}function d(a){a&&(i=!0,a.version&&(l=b(a.version)),!l&&a.description&&(l=b(a.description)),a.filename&&(k=c(a.filename)))}var e,f,g,i=!1,j=!1,k=!1,l="";if(h.plugins&&h.plugins.length)e=h.plugins["Shockwave Flash"],d(e),h.plugins["Shockwave Flash 2.0"]&&(i=!0,l="2.0.0.11");else if(h.mimeTypes&&h.mimeTypes.length)g=h.mimeTypes["application/x-shockwave-flash"],e=g&&g.enabledPlugin,d(e);else if("undefined"!=typeof a){j=!0;try{f=new a("ShockwaveFlash.ShockwaveFlash.7"),i=!0,l=b(f.GetVariable("$version"))}catch(m){try{f=new a("ShockwaveFlash.ShockwaveFlash.6"),i=!0,l="6.0.21"}catch(n){try{f=new a("ShockwaveFlash.ShockwaveFlash"),i=!0,l=b(f.GetVariable("$version"))}catch(o){j=!1}}}}N.disabled=i!==!0,N.outdated=l&&r(l)<r(O),N.version=l||"0.0.0",N.pluginType=k?"pepper":j?"activex":i?"netscape":"unknown"};Ub(o),Tb(!0);var Vb=function(){return this instanceof Vb?void("function"==typeof Vb._createClient&&Vb._createClient.apply(this,z(arguments))):new Vb};v(Vb,"version",{value:"2.2.0",writable:!1,configurable:!0,enumerable:!0}),Vb.config=function(){return $.apply(this,z(arguments))},Vb.state=function(){return _.apply(this,z(arguments))},Vb.isFlashUnusable=function(){return ab.apply(this,z(arguments))},Vb.on=function(){return bb.apply(this,z(arguments))},Vb.off=function(){return cb.apply(this,z(arguments))},Vb.handlers=function(){return db.apply(this,z(arguments))},Vb.emit=function(){return eb.apply(this,z(arguments))},Vb.create=function(){return fb.apply(this,z(arguments))},Vb.destroy=function(){return gb.apply(this,z(arguments))},Vb.setData=function(){return hb.apply(this,z(arguments))},Vb.clearData=function(){return ib.apply(this,z(arguments))},Vb.getData=function(){return jb.apply(this,z(arguments))},Vb.focus=Vb.activate=function(){return kb.apply(this,z(arguments))},Vb.blur=Vb.deactivate=function(){return lb.apply(this,z(arguments))},Vb.activeElement=function(){return mb.apply(this,z(arguments))};var Wb=0,Xb={},Yb=0,Zb={},$b={};A(Z,{autoActivate:!0});var _b=function(a){var b=this;b.id=""+Wb++,Xb[b.id]={instance:b,elements:[],handlers:{}},a&&b.clip(a),Vb.on("*",function(a){return b.emit(a)}),Vb.on("destroy",function(){b.destroy()}),Vb.create()},ac=function(a,d){var e,f,g,h={},i=Xb[this.id],j=i&&i.handlers;if(!i)throw new Error("Attempted to add new listener(s) to a destroyed ZeroClipboard client instance");if("string"==typeof a&&a)g=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof d)for(e in a)w.call(a,e)&&"string"==typeof e&&e&&"function"==typeof a[e]&&this.on(e,a[e]);if(g&&g.length){for(e=0,f=g.length;f>e;e++)a=g[e].replace(/^on/,""),h[a]=!0,j[a]||(j[a]=[]),j[a].push(d);if(h.ready&&N.ready&&this.emit({type:"ready",client:this}),h.error){for(e=0,f=W.length;f>e;e++)if(N[W[e].replace(/^flash-/,"")]){this.emit({type:"error",name:W[e],client:this});break}c!==b&&Vb.version!==c&&this.emit({type:"error",name:"version-mismatch",jsVersion:Vb.version,swfVersion:c})}}return this},bc=function(a,b){var c,d,e,f,g,h=Xb[this.id],i=h&&h.handlers;if(!i)return this;if(0===arguments.length)f=u(i);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)w.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=i[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return this},cc=function(a){var b=null,c=Xb[this.id]&&Xb[this.id].handlers;return c&&(b="string"==typeof a&&a?c[a]?c[a].slice(0):[]:B(c)),b},dc=function(a){if(ic.call(this,a)){"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(a=A({},a));var b=A({},ob(a),{client:this});jc.call(this,b)}return this},ec=function(a){if(!Xb[this.id])throw new Error("Attempted to clip element(s) to a destroyed ZeroClipboard client instance");a=kc(a);for(var b=0;b<a.length;b++)if(w.call(a,b)&&a[b]&&1===a[b].nodeType){a[b].zcClippingId?-1===Zb[a[b].zcClippingId].indexOf(this.id)&&Zb[a[b].zcClippingId].push(this.id):(a[b].zcClippingId="zcClippingId_"+Yb++,Zb[a[b].zcClippingId]=[this.id],Z.autoActivate===!0&&lc(a[b]));var c=Xb[this.id]&&Xb[this.id].elements;-1===c.indexOf(a[b])&&c.push(a[b])}return this},fc=function(a){var b=Xb[this.id];if(!b)return this;var c,d=b.elements;a="undefined"==typeof a?d.slice(0):kc(a);for(var e=a.length;e--;)if(w.call(a,e)&&a[e]&&1===a[e].nodeType){for(c=0;-1!==(c=d.indexOf(a[e],c));)d.splice(c,1);var f=Zb[a[e].zcClippingId];if(f){for(c=0;-1!==(c=f.indexOf(this.id,c));)f.splice(c,1);0===f.length&&(Z.autoActivate===!0&&mc(a[e]),delete a[e].zcClippingId)}}return this},gc=function(){var a=Xb[this.id];return a&&a.elements?a.elements.slice(0):[]},hc=function(){Xb[this.id]&&(this.unclip(),this.off(),delete Xb[this.id])},ic=function(a){if(!a||!a.type)return!1;if(a.client&&a.client!==this)return!1;var b=Xb[this.id],c=b&&b.elements,d=!!c&&c.length>0,e=!a.target||d&&-1!==c.indexOf(a.target),f=a.relatedTarget&&d&&-1!==c.indexOf(a.relatedTarget),g=a.client&&a.client===this;return b&&(e||f||g)?!0:!1},jc=function(a){var b=Xb[this.id];if("object"==typeof a&&a&&a.type&&b){var c=rb(a),d=b&&b.handlers["*"]||[],e=b&&b.handlers[a.type]||[],g=d.concat(e);if(g&&g.length){var h,i,j,k,l,m=this;for(h=0,i=g.length;i>h;h++)j=g[h],k=m,"string"==typeof j&&"function"==typeof f[j]&&(j=f[j]),"object"==typeof j&&j&&"function"==typeof j.handleEvent&&(k=j,j=j.handleEvent),"function"==typeof j&&(l=A({},a),sb(j,k,[l],c))}}},kc=function(a){return"string"==typeof a&&(a=[]),"number"!=typeof a.length?[a]:a},lc=function(a){if(a&&1===a.nodeType){var b=function(a){(a||(a=f.event))&&("js"!==a._source&&(a.stopImmediatePropagation(),a.preventDefault()),delete a._source)},c=function(c){(c||(c=f.event))&&(b(c),Vb.focus(a))};a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",b,!1),a.addEventListener("mouseenter",b,!1),a.addEventListener("mouseleave",b,!1),a.addEventListener("mousemove",b,!1),$b[a.zcClippingId]={mouseover:c,mouseout:b,mouseenter:b,mouseleave:b,mousemove:b}}},mc=function(a){if(a&&1===a.nodeType){var b=$b[a.zcClippingId];if("object"==typeof b&&b){for(var c,d,e=["move","leave","enter","out","over"],f=0,g=e.length;g>f;f++)c="mouse"+e[f],d=b[c],"function"==typeof d&&a.removeEventListener(c,d,!1);delete $b[a.zcClippingId]}}};Vb._createClient=function(){_b.apply(this,z(arguments))},Vb.prototype.on=function(){return ac.apply(this,z(arguments))},Vb.prototype.off=function(){return bc.apply(this,z(arguments))},Vb.prototype.handlers=function(){return cc.apply(this,z(arguments))},Vb.prototype.emit=function(){return dc.apply(this,z(arguments))},Vb.prototype.clip=function(){return ec.apply(this,z(arguments))},Vb.prototype.unclip=function(){return fc.apply(this,z(arguments))},Vb.prototype.elements=function(){return gc.apply(this,z(arguments))},Vb.prototype.destroy=function(){return hc.apply(this,z(arguments))},Vb.prototype.setText=function(a){if(!Xb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.setData("text/plain",a),this},Vb.prototype.setHtml=function(a){if(!Xb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.setData("text/html",a),this},Vb.prototype.setRichText=function(a){if(!Xb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.setData("application/rtf",a),this},Vb.prototype.setData=function(){if(!Xb[this.id])throw new Error("Attempted to set pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.setData.apply(this,z(arguments)),this},Vb.prototype.clearData=function(){if(!Xb[this.id])throw new Error("Attempted to clear pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.clearData.apply(this,z(arguments)),this},Vb.prototype.getData=function(){if(!Xb[this.id])throw new Error("Attempted to get pending clipboard data from a destroyed ZeroClipboard client instance");return Vb.getData.apply(this,z(arguments))}, true?!(__WEBPACK_AMD_DEFINE_RESULT__ = function(){return Vb}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Vb:a.ZeroClipboard=Vb}(function(){return this||window}());
//# sourceMappingURL=ZeroClipboard.min.map
/***/ },
/***/ 54:
/***/ function(module, exports, __webpack_require__) {
/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, boss:true, undef:true, curly:true, browser:true, jquery:true */
/*
* jQuery MultiSelect UI Widget 2.0.1
* Copyright (c) 2012 Eric Hynds
*
* Depends:
* - jQuery 1.4.2+
* - jQuery UI 1.11 widget factory
*
* Optional:
* - jQuery UI effects
* - jQuery UI position utility
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
var jquery = __webpack_require__(1);
(function($, undefined) {
// Counter used to prevent collisions
var multiselectID = 0;
var $doc = $(document);
$.widget("ech.multiselect", {
// default options
options: {
header: true,
height: 175,
minWidth: 225,
classes: '',
checkAllText: 'Check all',
uncheckAllText: 'Uncheck all',
noneSelectedText: 'Select options',
showCheckAll: true,
showUncheckAll: true,
selectedText: '# selected',
selectedList: 0,
closeIcon: 'ui-icon-circle-close',
show: null,
hide: null,
autoOpen: false,
multiple: true,
position: {},
appendTo: null,
menuWidth:null,
selectedListSeparator: ', ',
disableInputsOnToggle: true,
groupColumns: false
},
// This method determines which element to append the menu to
// Uses the element provided in the options first, then looks for ui-front / dialog
// Otherwise appends to the body
_getAppendEl: function() {
var element = this.options.appendTo;
if(element) {
element = element.jquery || element.nodeType ? $(element) : this.document.find(element).eq(0);
}
if(!element || !element[0]) {
element = this.element.closest(".ui-front, dialog");
}
if(!element.length) {
element = this.document[0].body;
}
return element;
},
// Performs the initial creation of the widget
_create: function() {
var el = this.element;
var o = this.options;
this.speed = $.fx.speeds._default; // default speed for effects
this._isOpen = false; // assume no
this.inputIdCounter = 0; // Incremented for each input item (option)
// create a unique namespace for events that the widget
// factory cannot unbind automatically. Use eventNamespace if on
// jQuery UI 1.9+, and otherwise fallback to a custom string.
this._namespaceID = this.eventNamespace || ('multiselect' + multiselectID);
// bump unique ID after assigning it to the widget instance
this.multiselectID = multiselectID++;
// The button that opens the widget menu
var button = (this.button = $('<button type="button"><span class="ui-icon ui-icon-triangle-1-s"></span></button>'))
.addClass('ui-multiselect ui-widget ui-state-default ui-corner-all ' + o.classes)
.attr({ 'title':el.attr('title'), 'tabIndex':el.attr('tabIndex'), 'id': el.attr('id') ? el.attr('id') + '_ms' : null })
.prop('aria-haspopup', true)
.insertAfter(el);
this.buttonlabel = $('<span />')
.html(o.noneSelectedText)
.appendTo(button);
// This is the menu that will hold all the options
this.menu = $('<div />')
.addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all ' + o.classes)
.appendTo(this._getAppendEl());
// Menu header to hold controls for the menu
this.header = $('<div />')
.addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix')
.appendTo(this.menu);
// Header controls, will contain the check all/uncheck all buttons
// Depending on how the options are set, this may be empty or simply plain text
this.headerLinkContainer = $('<ul />')
.addClass('ui-helper-reset')
.html(function() {
if(o.header === true) {
var header_lis = '';
if(o.showCheckAll) {
header_lis = '<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>' + o.checkAllText + '</span></a></li>';
}
if(o.showUncheckAll) {
header_lis += '<li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>' + o.uncheckAllText + '</span></a></li>';
}
return header_lis;
} else if(typeof o.header === "string") {
return '<li>' + o.header + '</li>';
} else {
return '';
}
})
.append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon '+o.closeIcon+'"></span></a></li>')
.appendTo(this.header);
// Holds the actual check boxes for inputs
var checkboxContainer = (this.checkboxContainer = $('<ul />'))
.addClass('ui-multiselect-checkboxes ui-helper-reset')
.appendTo(this.menu);
this._bindEvents();
// build menu
this.refresh(true);
// If this is a single select widget, add the appropriate class
if(!o.multiple) {
this.menu.addClass('ui-multiselect-single');
}
el.hide();
},
// https://api.jqueryui.com/jquery.widget/#method-_init
_init: function() {
if(this.options.header === false) {
this.header.hide();
}
if(!this.options.multiple) {
this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').hide();
} else {
this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').show();
}
if(this.options.autoOpen) {
this.open();
}
if(this.element.is(':disabled')) {
this.disable();
}
},
/*
* Builds an option item for the menu
* <li>
* <label>
* <input /> checkbox or radio depending on single/multiple select
* <span /> option text
* </label>
* </li>
*/
_makeOption: function(option) {
var title = option.title ? option.title : null;
var value = option.value;
var id = this.element.attr('id') || this.multiselectID; // unique ID for the label & option tags
var inputID = 'ui-multiselect-' + this.multiselectID + '-' + (option.id || id + '-option-' + this.inputIdCounter++);
var isDisabled = option.disabled;
var isSelected = option.selected;
var labelClasses = [ 'ui-corner-all' ];
var liClasses = [];
var o = this.options;
if(isDisabled) {
liClasses.push('ui-multiselect-disabled');
labelClasses.push('ui-state-disabled');
}
if(option.className) {
liClasses.push(option.className);
}
if(isSelected && !o.multiple) {
labelClasses.push('ui-state-active');
}
var $item = $("<li/>").addClass(liClasses.join(' '));
var $label = $("<label/>").attr({
"for": inputID,
"title": title
}).addClass(labelClasses.join(' ')).appendTo($item);
var $input = $("<input/>").attr({
"name": "multiselect_" + id,
"type": o.multiple ? "checkbox" : "radio",
"value": value,
"title": title,
"id": inputID,
"checked": isSelected ? "checked" : null,
"aria-selected": isSelected ? "true" : null,
"disabled": isDisabled ? "disabled" : null,
"aria-disabled": isDisabled ? "true" : null
}).data($(option).data()).appendTo($label);
var $span = $("<span/>").text($(option).text());
if($input.data("image-src")) {
$span.prepend($("<img/>").attr({"src": $input.data("image-src")}));
}
$span.appendTo($label);
return $item;
},
// Builds a menu item for each option in the underlying select
// Option groups are built here as well
_buildOptionList: function(element, $appendTo) {
var self = this;
element.children().each(function() {
var $this = $(this);
if(this.tagName === 'OPTGROUP') {
var $optionGroup = $("<ul/>").addClass('ui-multiselect-optgroup ' + this.className).appendTo($appendTo);
if(self.options.groupColumns) {
$optionGroup.addClass("ui-multiselect-columns");
}
$("<a/>").text(this.getAttribute('label')).appendTo($optionGroup);
self._buildOptionList($this, $optionGroup);
} else {
var $listItem = self._makeOption(this).appendTo($appendTo);
}
});
},
// Refreshes the widget to pick up changes to the underlying select
// Rebuilds the menu, sets button width
refresh: function(init) {
var self = this;
var el = this.element;
var o = this.options;
var menu = this.menu;
var checkboxContainer = this.checkboxContainer;
var $dropdown = $("<ul/>").addClass('ui-multiselect-checkboxes ui-helper-reset');
this.inputIdCounter = 0;
// update header link container visibility if needed
if (this.options.header) {
if(!this.options.multiple) {
this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').hide();
} else {
this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').show();
}
}
this._buildOptionList(el, $dropdown);
this.menu.find(".ui-multiselect-checkboxes").remove();
this.menu.append($dropdown);
// cache some moar useful elements
this.labels = menu.find('label');
this.inputs = this.labels.children('input');
this._setButtonWidth();
this.update(true);
// broadcast refresh event; useful for widgets
if(!init) {
this._trigger('refresh');
}
},
// updates the button text. call refresh() to rebuild
update: function(isDefault) {
var o = this.options;
var $inputs = this.inputs;
var $checked = $inputs.filter(':checked');
var numChecked = $checked.length;
var value;
if(numChecked === 0) {
value = o.noneSelectedText;
} else {
if($.isFunction(o.selectedText)) {
value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get());
} else if(/\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList) {
value = $checked.map(function() { return $(this).next().text(); }).get().join(o.selectedListSeparator);
} else {
value = o.selectedText.replace('#', numChecked).replace('#', $inputs.length);
}
}
this._setButtonValue(value);
if(isDefault) {
this.button[0].defaultValue = value;
}
},
// this exists as a separate method so that the developer
// can easily override it, usually to allow injecting HTML if they really want it
_setButtonValue: function(value) {
this.buttonlabel.text(value);
},
_bindButtonEvents: function() {
var self = this;
var button = this.button;
function clickHandler() {
self[ self._isOpen ? 'close' : 'open' ]();
return false;
}
// webkit doesn't like it when you click on the span :(
button
.find('span')
.bind('click.multiselect', clickHandler);
// button events
button.bind({
click: clickHandler,
keypress: function(e) {
switch(e.which) {
case 27: // esc
case 38: // up
case 37: // left
self.close();
break;
case 39: // right
case 40: // down
self.open();
break;
}
},
mouseenter: function() {
if(!button.hasClass('ui-state-disabled')) {
$(this).addClass('ui-state-hover');
}
},
mouseleave: function() {
$(this).removeClass('ui-state-hover');
},
focus: function() {
if(!button.hasClass('ui-state-disabled')) {
$(this).addClass('ui-state-focus');
}
},
blur: function() {
$(this).removeClass('ui-state-focus');
}
});
},
_bindMenuEvents: function() {
var self = this;
// optgroup label toggle support
this.menu.on('click.multiselect', '.ui-multiselect-optgroup a', function(e) {
e.preventDefault();
var $this = $(this);
var $inputs = $this.parent().find('input:visible:not(:disabled)');
var nodes = $inputs.get();
var label = $this.text();
// trigger event and bail if the return is false
if(self._trigger('beforeoptgrouptoggle', e, { inputs:nodes, label:label }) === false) {
return;
}
// toggle inputs
self._toggleChecked(
$inputs.filter(':checked').length !== $inputs.length,
$inputs
);
self._trigger('optgrouptoggle', e, {
inputs: nodes,
label: label,
checked: nodes.length ? nodes[0].checked : null
});
})
.on('mouseenter.multiselect', 'label', function() {
if(!$(this).hasClass('ui-state-disabled')) {
self.labels.removeClass('ui-state-hover');
$(this).addClass('ui-state-hover').find('input').focus();
}
})
.on('keydown.multiselect', 'label', function(e) {
if(e.which === 82) {
return; //"r" key, often used for reload.
}
if(e.which > 111 && e.which < 124) {
return; //Keyboard function keys.
}
e.preventDefault();
switch(e.which) {
case 9: // tab
if(e.shiftKey) {
self.menu.find(".ui-state-hover").removeClass("ui-state-hover");
self.header.find("li").last().find("a").focus();
} else {
self.close();
}
break;
case 27: // esc
self.close();
break;
case 38: // up
case 40: // down
case 37: // left
case 39: // right
self._traverse(e.which, this);
break;
case 13: // enter
case 32: //space
$(this).find('input')[0].click();
break;
case 65: // a
if(e.altKey) {
self.checkAll();
}
break;
case 85: // u
if(e.altKey) {
self.uncheckAll();
}
break;
}
})
.on('click.multiselect', 'input[type="checkbox"], input[type="radio"]', function(e) {
var $this = $(this);
var val = this.value;
var optionText = $this.parent().find("span").text();
var checked = this.checked;
var tags = self.element.find('option');
// bail if this input is disabled or the event is cancelled
if(this.disabled || self._trigger('click', e, { value: val, text: optionText, checked: checked }) === false) {
e.preventDefault();
return;
}
// make sure the input has focus. otherwise, the esc key
// won't close the menu after clicking an item.
$this.focus();
// toggle aria state
$this.prop('aria-selected', checked);
// change state on the original option tags
tags.each(function() {
if(this.value === val) {
this.selected = checked;
} else if(!self.options.multiple) {
this.selected = false;
}
});
// some additional single select-specific logic
if(!self.options.multiple) {
self.labels.removeClass('ui-state-active');
$this.closest('label').toggleClass('ui-state-active', checked);
// close menu
self.close();
}
// fire change on the select box
self.element.trigger("change");
// setTimeout is to fix multiselect issue #14 and #47. caused by jQuery issue #3827
// http://bugs.jquery.com/ticket/3827
setTimeout($.proxy(self.update, self), 10);
});
},
_bindHeaderEvents: function() {
var self = this;
// header links
this.header.on('click.multiselect', 'a', function(e) {
var $this = $(this);
if($this.hasClass('ui-multiselect-close')) {
self.close();
} else if($this.hasClass("ui-multiselect-all")) {
self.checkAll();
} else if($this.hasClass("ui-multiselect-none")) {
self.uncheckAll();
}
e.preventDefault();
}).on('keydown.multiselect', 'a', function(e) {
switch(e.which) {
case 27: // esc
self.close();
break;
case 9: // tab
var $target = $(e.target);
if((e.shiftKey && !$target.parent().prev().length && !self.header.find(".ui-multiselect-filter").length) || (!$target.parent().next().length && !self.labels.length && !e.shiftKey)) {
self.close();
e.preventDefault();
}
break;
}
});
},
_bindEvents: function() {
var self = this;
this._bindButtonEvents();
this._bindMenuEvents();
this._bindHeaderEvents();
// close each widget when clicking on any other element/anywhere else on the page
$doc.bind('mousedown.' + self._namespaceID, function(event) {
var target = event.target;
if(self._isOpen &&
target !== self.button[0] &&
target !== self.menu[0] &&
!$.contains(self.menu[0], target) &&
!$.contains(self.button[0], target)
) {
self.close();
}
});
// deal with form resets. the problem here is that buttons aren't
// restored to their defaultValue prop on form reset, and the reset
// handler fires before the form is actually reset. delaying it a bit
// gives the form inputs time to clear.
$(this.element[0].form).bind('reset.' + this._namespaceID, function() {
setTimeout($.proxy(self.refresh, self), 10);
});
},
// Determines the minimum width for the button and menu
// Can be a number, a digit string, or a percentage
_getMinWidth: function() {
var minVal = this.options.minWidth;
var width = 0;
switch (typeof minVal) {
case 'number':
width = minVal;
break;
case 'string':
var lastChar = minVal[ minVal.length -1 ];
width = minVal.match(/\d+/);
if(lastChar === '%') {
width = this.element.parent().outerWidth() * (width/100);
} else {
width = parseInt(minVal, 10);
}
break;
}
return width;
},
// set button width
_setButtonWidth: function() {
var width = this.element.outerWidth();
var minVal = this._getMinWidth();
if(width < minVal) {
width = minVal;
}
// set widths
this.button.outerWidth(width);
},
// set menu width
_setMenuWidth: function() {
var m = this.menu;
var width = (this.button.outerWidth() <= 0) ? this._getMinWidth() : this.button.outerWidth();
m.outerWidth(this.options.menuWidth || width);
},
// Sets the height of the menu
// Will set a scroll bar if the menu height exceeds that of the height in options
_setMenuHeight: function() {
var headerHeight = this.menu.children(".ui-multiselect-header:visible").outerHeight(true);
var ulHeight = 0;
this.menu.find(".ui-multiselect-optgroup").each(function(idx, ul) {
ulHeight += $(ul).outerHeight(true);
});
this.menu.find(".ui-multiselect-checkboxes > li").each(function(idx, li) {
ulHeight += $(li).outerHeight(true);
});
if(ulHeight > this.options.height) {
this.menu.children(".ui-multiselect-checkboxes").css("overflow", "auto");
ulHeight = this.options.height;
} else {
this.menu.children(".ui-multiselect-checkboxes").css("overflow", "hidden");
}
this.menu.children(".ui-multiselect-checkboxes").height(ulHeight);
this.menu.height(ulHeight + headerHeight);
},
// Resizes the menu, called every time the menu is opened
_resizeMenu: function() {
this._setMenuWidth();
this._setMenuHeight();
},
// move up or down within the menu
_traverse: function(which, start) {
var $start = $(start);
var moveToLast = which === 38 || which === 37;
// select the first li that isn't an optgroup label / disabled
var $next = $start.parent()[moveToLast ? 'prevAll' : 'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup):visible').first();
// we might have to jump to the next/previous option group
if(!$next.length) {
$next = $start.parents(".ui-multiselect-optgroup")[moveToLast ? "prev" : "next" ]();
}
// if at the first/last element
if(!$next.length) {
var $container = this.menu.find('ul').last();
// move to the first/last
this.menu.find('label:visible')[ moveToLast ? 'last' : 'first' ]().trigger('mouseover');
// set scroll position
$container.scrollTop(moveToLast ? $container.height() : 0);
} else {
$next.find('label:visible')[ moveToLast ? "last" : "first" ]().trigger('mouseover');
}
},
// This is an internal function to toggle the checked property and
// other related attributes of a checkbox.
//
// The context of this function should be a checkbox; do not proxy it.
_toggleState: function(prop, flag) {
return function() {
if(!this.disabled) {
this[ prop ] = flag;
}
if(flag) {
this.setAttribute('aria-selected', true);
} else {
this.removeAttribute('aria-selected');
}
};
},
// Toggles checked state on either an option group or all inputs
_toggleChecked: function(flag, group) {
var $inputs = (group && group.length) ? group : this.inputs;
var self = this;
// toggle state on inputs
$inputs.each(this._toggleState('checked', flag));
// give the first input focus
$inputs.eq(0).focus();
// update button text
this.update();
// gather an array of the values that actually changed
var values = {};
$inputs.each(function() {
values[this.value] = true;
});
// toggle state on original option tags
this.element
.find('option')
.each(function() {
if(!this.disabled && values[this.value]) {
self._toggleState('selected', flag).call(this);
}
});
// trigger the change event on the select
if($inputs.length) {
this.element.trigger("change");
}
},
// Toggle disable state on the widget and underlying select
_toggleDisabled: function(flag) {
this.button.prop({ 'disabled':flag, 'aria-disabled':flag })[ flag ? 'addClass' : 'removeClass' ]('ui-state-disabled');
if(this.options.disableInputsOnToggle) {
var checkboxes = this.menu.find(".ui-multiselect-checkboxes").get(0);
var matchedInputs = [];
var key = "ech-multiselect-disabled";
var i = 0;
if(flag) {
// remember which elements this widget disabled (not pre-disabled)
// elements, so that they can be restored if the widget is re-enabled.
matchedInputs = checkboxes.querySelectorAll("input:enabled");
for(i = 0; i < matchedInputs.length; i++) {
matchedInputs[i].setAttribute(key, true);
matchedInputs[i].setAttribute("disabled", "disabled");
matchedInputs[i].setAttribute("aria-disabled", "disabled");
matchedInputs[i].parentNode.className = matchedInputs[i].parentNode.className + " ui-state-disabled";
}
} else {
matchedInputs = checkboxes.querySelectorAll("input:disabled");
for(i = 0; i < matchedInputs.length; i++) {
if(matchedInputs[i].hasAttribute(key)) {
matchedInputs[i].removeAttribute(key);
matchedInputs[i].removeAttribute("disabled");
matchedInputs[i].removeAttribute("aria-disabled");
matchedInputs[i].parentNode.className = matchedInputs[i].parentNode.className.replace(" ui-state-disabled", "");
}
}
}
}
this.element.prop({
'disabled':flag,
'aria-disabled':flag
});
},
// open the menu
open: function(e) {
var self = this;
var button = this.button;
var menu = this.menu;
var speed = this.speed;
var o = this.options;
var args = [];
// bail if the multiselectopen event returns false, this widget is disabled, or is already open
if(this._trigger('beforeopen') === false || button.hasClass('ui-state-disabled') || this._isOpen) {
return;
}
var $container = menu.find('.ui-multiselect-checkboxes');
var effect = o.show;
// figure out opening effects/speeds
if($.isArray(o.show)) {
effect = o.show[0];
speed = o.show[1] || self.speed;
}
// if there's an effect, assume jQuery UI is in use
// build the arguments to pass to show()
if(effect) {
args = [ effect, speed ];
}
// set the scroll of the checkbox container
$container.scrollTop(0);
// show the menu, maybe with a speed/effect combo
$.fn.show.apply(menu, args);
this._resizeMenu();
// positon
this.position();
// Set focus to the first selected (in single mode) or not disabled option or the filter input if available
var $firstSelected = !o.multiple ? $container.find('li>.ui-state-active').first() : [];
if ($firstSelected.length) {
$firstSelected.trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');
}
var filter = this.header.find(".ui-multiselect-filter");
if(filter.length) {
filter.first().find('input').trigger('focus');
} else if(this.labels.length){
if (!$firstSelected.length) {
this.labels.filter(':not(.ui-state-disabled)').eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');
}
} else {
this.header.find('a').first().trigger('focus');
}
button.addClass('ui-state-active');
this._isOpen = true;
this._trigger('open');
},
// close the menu
close: function() {
if(this._trigger('beforeclose') === false) {
return;
}
var o = this.options;
var effect = o.hide;
var speed = this.speed;
var args = [];
// figure out opening effects/speeds
if($.isArray(o.hide)) {
effect = o.hide[0];
speed = o.hide[1] || this.speed;
}
if(effect) {
args = [ effect, speed ];
}
$.fn.hide.apply(this.menu, args);
this.button.removeClass('ui-state-active').trigger('blur').trigger('mouseleave');
this._isOpen = false;
this._trigger('close');
this.button.trigger('focus');
},
enable: function() {
this._toggleDisabled(false);
},
disable: function() {
this._toggleDisabled(true);
},
checkAll: function(e) {
this._toggleChecked(true);
this._trigger('checkAll');
},
uncheckAll: function() {
this._toggleChecked(false);
this._trigger('uncheckAll');
},
getChecked: function() {
return this.menu.find('input').filter(':checked');
},
getUnchecked: function() {
return this.menu.find('input').not(':checked');
},
destroy: function() {
// remove classes + data
$.Widget.prototype.destroy.call(this);
// unbind events
$doc.unbind(this._namespaceID);
$(this.element[0].form).unbind(this._namespaceID);
this.button.remove();
this.menu.remove();
this.element.show();
return this;
},
isOpen: function() {
return this._isOpen;
},
widget: function() {
return this.menu;
},
getButton: function() {
return this.button;
},
getMenu: function() {
return this.menu;
},
getLabels: function() {
return this.labels;
},
/*
* Adds an option to the widget and underlying select
* attributes: Attributes hash to add to the option
* text: text of the option
* groupLabel: Option Group to add the option to
*/
addOption: function(attributes, text, groupLabel) {
var $option = $("<option/>").attr(attributes).text(text);
var optionNode = $option.get(0);
if(groupLabel) {
this.element.children("OPTGROUP").filter(function() {
return $(this).prop("label") === groupLabel;
}).append($option);
this.menu.find(".ui-multiselect-optgroup").filter(function() {
return $(this).find("a").text() === groupLabel;
}).append(this._makeOption(optionNode));
} else {
this.element.append($option);
this.menu.find(".ui-multiselect-checkboxes").append(this._makeOption(optionNode));
}
//update cached elements
this.labels = this.menu.find('label');
this.inputs = this.labels.children('input');
},
removeOption: function(value) {
if(!value) {
return;
}
this.element.find("option[value=" + value + "]").remove();
this.labels.find("input[value=" + value + "]").parents("li").remove();
//update cached elements
this.labels = this.menu.find('label');
this.inputs = this.labels.children('input');
},
position: function() {
var pos = {
my: "top",
at: "bottom",
of: this.button,
collision: "flip",
using : null,
within: window
};
if(!$.isEmptyObject(this.options.position)) {
pos.my = this.options.position.my || pos.my;
pos.at = this.options.position.at || pos.at;
pos.of = this.options.position.of || pos.of;
pos.collision = this.options.position.collision || pos.collision;
pos.using = this.options.position.using || pos.using;
pos.within = this.options.position.within || pos.within;
}
if($.ui && $.ui.position) {
this.menu.position(pos);
} else {
pos = this.button.position();
pos.top += this.button.outerHeight(false);
this.menu.offset(pos);
}
},
// react to option changes after initialization
_setOption: function(key, value) {
var menu = this.menu;
switch(key) {
case 'header':
if(typeof value === 'boolean') {
this.header[value ? 'show' : 'hide']();
} else if(typeof value === 'string') {
this.headerLinkContainer.children("li:not(:last-child)").remove();
this.headerLinkContainer.prepend("<li>" + value + "</li>");
}
break;
case 'checkAllText':
menu.find('a.ui-multiselect-all span').eq(-1).text(value);
break;
case 'uncheckAllText':
menu.find('a.ui-multiselect-none span').eq(-1).text(value);
break;
case 'height':
this.options[key] = value;
this._setMenuHeight();
break;
case 'minWidth':
case 'menuWidth':
this.options[key] = value;
this._setButtonWidth();
this._setMenuWidth();
break;
case 'selectedText':
case 'selectedList':
case 'noneSelectedText':
this.options[key] = value; // these all needs to update immediately for the update() call
this.update();
break;
case 'classes':
menu.add(this.button).removeClass(this.options.classes).addClass(value);
break;
case 'multiple':
menu.toggleClass('ui-multiselect-single', !value);
this.options.multiple = value;
this.element[0].multiple = value;
this.uncheckAll();
this.refresh();
break;
case 'position':
this.position();
break;
case 'selectedListSeparator':
this.options[key] = value;
this.update(true);
break;
}
$.Widget.prototype._setOption.apply(this, arguments);
}
});
})(jquery);
/***/ },
/***/ 55:
/***/ function(module, exports, __webpack_require__) {
/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, boss:true, undef:true, curly:true, browser:true, jquery:true */
/*
* jQuery MultiSelect UI Widget Filtering Plugin 2.0.1
* Copyright (c) 2012 Eric Hynds
*
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
*
* Depends:
* - jQuery UI MultiSelect widget
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
var jQuery = __webpack_require__(1);
(function($) {
var rEscape = /[\-\[\]{}()*+?.,\\\^$|#\s]/g;
//Courtesy of underscore.js
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
}
$.widget('ech.multiselectfilter', {
options: {
label: 'Filter:',
width: null, /* override default width set in css file (px). null will inherit */
placeholder: 'Enter keywords',
autoReset: false,
debounceMS: 250
},
_create: function() {
var opts = this.options;
var elem = $(this.element);
// get the multiselect instance
this.instance = elem.multiselect('instance');
// store header; add filter class so the close/check all/uncheck all links can be positioned correctly
this.header = this.instance.menu.find('.ui-multiselect-header').addClass('ui-multiselect-hasfilter');
// wrapper elem
this.input = $("<input/>").attr({
placeholder: opts.placeholder,
type: "search"
}).css({
width: (/\d/.test(opts.width) ? opts.width + 'px' : null)
}).bind({
keydown: function(e) {
// prevent the enter key from submitting the form / closing the widget
if(e.which === 13) {
e.preventDefault();
} else if(e.which === 27) {
elem.multiselect('close');
e.preventDefault();
} else if(e.which === 9 && e.shiftKey) {
elem.multiselect('close');
e.preventDefault();
} else if(e.altKey) {
switch(e.which) {
case 82:
e.preventDefault();
$(this).val('').trigger('input', '');
break;
case 65:
elem.multiselect('checkAll');
break;
case 85:
elem.multiselect('uncheckAll');
break;
case 76:
elem.multiselect('instance').labels.first().trigger("mouseenter");
break;
}
}
},
input: $.proxy(debounce(this._handler, opts.debounceMS), this),
search: $.proxy(this._handler, this)
});
// automatically reset the widget on close?
if(this.options.autoReset) {
elem.bind('multiselectclose', $.proxy(this._reset, this));
}
// rebuild cache when multiselect is updated
elem.bind('multiselectrefresh', $.proxy(function() {
this.updateCache();
this._handler();
}, this));
this.wrapper = $("<div/>").addClass("ui-multiselect-filter").text(opts.label).append(this.input).prependTo(this.header);
// reference to the actual inputs
this.inputs = this.instance.menu.find('input[type="checkbox"], input[type="radio"]');
// cache input values for searching
this.updateCache();
// rewrite internal _toggleChecked fn so that when checkAll/uncheckAll is fired,
// only the currently filtered elements are checked
this.instance._toggleChecked = function(flag, group) {
var $inputs = (group && group.length) ? group : this.labels.find('input');
var _self = this;
// do not include hidden elems if the menu isn't open.
var selector = _self._isOpen ? ':disabled, :hidden' : ':disabled';
$inputs = $inputs
.not(selector)
.each(this._toggleState('checked', flag));
// update text
this.update();
// gather an array of the values that actually changed
var values = {};
$inputs.each(function() {
values[this.value] = true;
});
// select option tags
this.element.find('option').filter(function() {
if(!this.disabled && values[this.value]) {
_self._toggleState('selected', flag).call(this);
}
});
// trigger the change event on the select
if($inputs.length) {
this.element.trigger('change');
}
};
},
// thx for the logic here ben alman
_handler: function(e) {
var term = $.trim(this.input[0].value.toLowerCase()),
// speed up lookups
rows = this.rows, inputs = this.inputs, cache = this.cache;
var $groups = this.instance.menu.find(".ui-multiselect-optgroup");
$groups.show();
if(!term) {
rows.show();
} else {
rows.hide();
var regex = new RegExp(term.replace(rEscape, "\\$&"), 'gi');
this._trigger("filter", e, $.map(cache, function(v, i) {
if(v.search(regex) !== -1) {
rows.eq(i).show();
return inputs.get(i);
}
return null;
}));
}
// show/hide optgroups
$groups.each(function() {
var $this = $(this);
// check with a function on display:none css instead of using :visible selector because newly created
// (on refresh) items are by default not (yet) visible but not hidden on purpose with the display:none.
if(!$this.children('li').filter(function () { return $.css(this, "display") !== 'none' }).length) {
$this.hide();
}
});
this.instance._setMenuHeight();
},
_reset: function() {
this.input.val('').trigger('input', '');
},
updateCache: function() {
// each list item
this.rows = this.instance.labels.parent();
// cache
this.cache = this.element.children().map(function() {
var elem = $(this);
// account for optgroups
if(this.tagName.toLowerCase() === "optgroup") {
elem = elem.children();
}
return elem.map(function() {
return this.innerHTML.toLowerCase();
}).get();
}).get();
},
widget: function() {
return this.wrapper;
},
destroy: function() {
$.Widget.prototype.destroy.call(this);
this.input.val('').trigger("keyup");
this.wrapper.remove();
}
});
})(jQuery);
/***/ }
});