w-table-vue 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/w-table-vue.umd.js +3 -3
  3. package/dist/w-table-vue.umd.js.map +1 -1
  4. package/docs/examples/app.html +1 -1
  5. package/docs/examples/app.umd.js +2 -2
  6. package/docs/examples/app.umd.js.map +1 -1
  7. package/docs/examples/w-table-edit_default.html +1 -1
  8. package/docs/examples/w-table-edit_editable.html +1 -1
  9. package/docs/examples/w-table-edit_editable_checkId.html +1 -1
  10. package/docs/examples/w-table-edit_editable_checkId_opt.modifyDataWhenSave_save(call cmp. method).html +1 -1
  11. package/docs/examples/w-table-edit_editable_checkId_successMsgFromAddRow_errorMsgFromAddRow.html +1 -1
  12. package/docs/examples/w-table-edit_editable_inforPaddingStyle_menuBackgroundColor.html +1 -1
  13. package/docs/examples/w-table-edit_editable_language_checkId_tooltipAddRow.html +1 -1
  14. package/docs/examples/w-table-edit_editable_language_textLabelDataName_textPlaceholderDataName.html +1 -1
  15. package/docs/examples/w-table-edit_editable_no enableInfor.html +1 -1
  16. package/docs/examples/w-table-edit_editable_no enableMenu.html +1 -1
  17. package/docs/examples/w-table-edit_editable_opt.beforeAddRow.html +1 -1
  18. package/docs/examples/w-table-edit_editable_opt.kpConvertKeysWhenUploadData.html +1 -1
  19. package/docs/examples/w-table-edit_editable_opt.optForUploadData.html +1 -1
  20. package/docs/examples/w-table-edit_editable_slot btns-right.html +1 -1
  21. package/docs/examples/w-table-edit_fixIds (fix id).html +1 -1
  22. package/docs/examples/w-table-edit_hideIds (hide mappingId).html +1 -1
  23. package/docs/examples/w-table-edit_name_description.html +1 -1
  24. package/docs/examples/w-table-edit_no enableInfor.html +1 -1
  25. package/docs/examples/w-table-edit_no enableMenu.html +1 -1
  26. package/docs/examples/w-table-edit_opt.kpHead.html +1 -1
  27. package/docs/examples/w-table-edit_removeIdsWhenDownload (remove id, mappingId, order, isActive).html +1 -1
  28. package/docs/examples/w-table-edit_slot btns-left.html +1 -1
  29. package/docs/examples/w-table-edit_slot btns-right.html +1 -1
  30. package/docs/examples/w-table-edit_slot cell-render.html +530 -0
  31. package/docs/examples/w-table-edit_slot cell-tooltip.html +530 -0
  32. package/docs/examples/w-table-edit_slot head-render.html +530 -0
  33. package/docs/examples/w-table-edit_slot head-tooltip.html +536 -0
  34. package/docs/examples/w-table-edit_slot infor (name_description).html +1 -1
  35. package/docs/examples/w-table-edit_sortColIds (sort by order).html +1 -1
  36. package/docs/index.html +1 -1
  37. package/docs/module-WTableEdit.html +1 -49
  38. package/package.json +3 -3
  39. package/src/AppZoneWTableEdit.vue +104 -0
  40. package/src/components/WTableEdit.vue +24 -5
@@ -0,0 +1,530 @@
1
+ <!doctype html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-tw">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
8
+ />
9
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
10
+ <title>w-table-vue</title>
11
+
12
+ <!-- @babel/polyfill -->
13
+ <script
14
+ nomodule
15
+ src="https://cdn.jsdelivr.net/npm/@babel/polyfill/dist/polyfill.min.js"
16
+ ></script>
17
+
18
+ <!-- vue -->
19
+ <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.min.js"></script>
20
+
21
+ <!-- extractHtml已自動添加@babel/polyfill與vue -->
22
+
23
+ <!-- fontawesome -->
24
+ <link
25
+ href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css"
26
+ rel="stylesheet"
27
+ />
28
+
29
+ <!-- mdi, 各組件使用mdi/js會於轉單頁時改為mdi icon, 故需引用mdi/css -->
30
+ <link
31
+ href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css"
32
+ rel="stylesheet"
33
+ />
34
+
35
+ <!-- google, 各組件使用mdi/js故不需引用 -->
36
+ <link
37
+ _href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"
38
+ rel="stylesheet"
39
+ />
40
+ <link
41
+ _href="https://fonts.googleapis.com/css?family=Material+Icons"
42
+ rel="stylesheet"
43
+ />
44
+
45
+ <!-- w-table-vue -->
46
+ <script src="https://cdn.jsdelivr.net/npm/w-table-vue@1.0.13/dist/w-table-vue.umd.js"></script>
47
+
48
+ <style>
49
+ .item {
50
+ /* 因item位於demolink, 提取各範例html後會刪除demolink, 故得額外補上 */
51
+ border-left: 3px solid #ffba75;
52
+ margin: 5px 5px 8px 0px;
53
+ padding: 3px 3px 5px 10px;
54
+ font-size: 0.9rem;
55
+ display: flex;
56
+ justify-content: flex-start;
57
+ align-items: center;
58
+ }
59
+ .head1 {
60
+ padding: 0px 0px 20px 0px;
61
+ font-size: 2.5rem;
62
+ }
63
+ .bkh {
64
+ /* 寬 */
65
+ padding: 20px;
66
+ }
67
+ @media screen and (max-width: 800px) {
68
+ /* 中 */
69
+ .bkh {
70
+ padding: 10px;
71
+ }
72
+ }
73
+ @media screen and (max-width: 400px) {
74
+ /* 窄 */
75
+ .bkh {
76
+ padding: 5px;
77
+ }
78
+ }
79
+ .bk {
80
+ /* 寬 */
81
+ display: inline-block;
82
+ vertical-align: top;
83
+ padding: 0px 80px 60px 0px;
84
+ }
85
+ @media screen and (max-width: 1000px) {
86
+ /* 中窄 */
87
+ .bk {
88
+ display: block;
89
+ padding: 0px 0px 50px 0px;
90
+ }
91
+ }
92
+ </style>
93
+ </head>
94
+ <body
95
+ style="font-family:'Microsoft JhengHei','Avenir','Helvetica'; padding:0px; margin:0px;"
96
+ >
97
+ <div id="app" class="bkh" style>
98
+ <div class="head1">
99
+ <span
100
+ style="cursor:pointer;"
101
+ title="open for copy link to view component"
102
+ onclick="window.open('//yuda-lyu.github.io/w-table-vue/examples/app.html?cmp='+this.innerText,'_blank')"
103
+ >w-table-edit</span>
104
+ </div>
105
+ <div class="bk">
106
+ <div class="item">slot cell-render</div>
107
+
108
+ <w-table-edit
109
+ style="width:600px; height:400px;"
110
+ :name="WTableEdit.name"
111
+ :description="WTableEdit.description"
112
+ :opt="WTableEdit.opt1"
113
+ @success="evSuccess"
114
+ @error="evError"
115
+ >
116
+ <template v-slot:cell-render="props">
117
+ <span
118
+ style="color:#aaa;"
119
+ v-if="props.key==='make'"
120
+ >{{ props.value }}</span>
121
+ <span
122
+ style="color:#2c6;"
123
+ v-else-if="props.key==='model'"
124
+ >{{ props.value }}</span>
125
+ <span
126
+ style="color:#f26;"
127
+ v-else-if="props.key==='price'"
128
+ >{{ props.value }}</span>
129
+ <span style="color:#aaa;" v-else>{{ props.value }}</span>
130
+ </template>
131
+ </w-table-edit>
132
+ </div>
133
+ </div>
134
+
135
+ <script>
136
+ //install
137
+ Vue.use(window["w-table-vue"]);
138
+
139
+ //initialize
140
+ new Vue({
141
+ el: "#app",
142
+
143
+ data: function() {
144
+ let keys1 = ["make", "model", "price"];
145
+ let kpHeadFilterType1 = {
146
+ //default: num (num,text,time,set)
147
+ make: "text",
148
+ model: "text",
149
+ price: "num"
150
+ };
151
+ let rows1 = [
152
+ { make: "Toyota", model: "Celica", price: 35000 },
153
+ { make: "Ford", model: "Mondeo", price: 32000 },
154
+ { make: "Porsche", model: "Boxter", price: 72000 },
155
+ { make: "BMW", model: "Sedan", price: 66000 },
156
+ { make: "Nissan", model: "March", price: 61000 },
157
+ { make: "Lexus", model: "RX", price: 56000 },
158
+ { make: "Audi", model: "A6 Allroad", price: 45000 },
159
+ { make: "Mazda", model: "MX-5", price: 36000 },
160
+ { make: "Mercedes-Benz", model: "Cabriolet", price: 86000 },
161
+ { make: "Volkswagen", model: "Beetle", price: 68000 },
162
+ { make: "Honda", model: "City", price: 69000 },
163
+ { make: "Volvo", model: "S60", price: 71000 },
164
+ { make: "Subaru", model: "BRZ", price: 48000 }
165
+ ];
166
+ let keys2 = [
167
+ "id",
168
+ "mappingId",
169
+ "order",
170
+ "make",
171
+ "model",
172
+ "price",
173
+ "isActive"
174
+ ];
175
+ let kpHeadFilterType2 = {
176
+ //default: num (num,text,time,set)
177
+ id: "text",
178
+ mappingId: "text",
179
+ order: "num",
180
+ make: "text",
181
+ model: "text",
182
+ price: "num",
183
+ isActive: "text"
184
+ };
185
+ let rows2 = [
186
+ {
187
+ id: "id-Toyota",
188
+ mappingId: "car_table",
189
+ order: 0,
190
+ make: "Toyota",
191
+ model: "Celica",
192
+ price: 35000,
193
+ isActive: "y"
194
+ },
195
+ {
196
+ id: "id-Ford",
197
+ mappingId: "car_table",
198
+ order: 1,
199
+ make: "Ford",
200
+ model: "Mondeo",
201
+ price: 32000,
202
+ isActive: "y"
203
+ },
204
+ {
205
+ id: "id-Porsche",
206
+ mappingId: "car_table",
207
+ order: 2,
208
+ make: "Porsche",
209
+ model: "Boxter",
210
+ price: 72000,
211
+ isActive: "y"
212
+ },
213
+ {
214
+ id: "id-BMW",
215
+ mappingId: "car_table",
216
+ order: 11,
217
+ make: "BMW",
218
+ model: "Sedan",
219
+ price: 66000,
220
+ isActive: "y"
221
+ },
222
+ {
223
+ id: "id-Nissan",
224
+ mappingId: "car_table",
225
+ order: 8,
226
+ make: "Nissan",
227
+ model: "March",
228
+ price: 61000,
229
+ isActive: "y"
230
+ },
231
+ {
232
+ id: "id-Lexus",
233
+ mappingId: "car_table",
234
+ order: 4,
235
+ make: "Lexus",
236
+ model: "RX",
237
+ price: 56000,
238
+ isActive: "y"
239
+ },
240
+ {
241
+ id: "id-Audi",
242
+ mappingId: "car_table",
243
+ order: 5,
244
+ make: "Audi",
245
+ model: "A6 Allroad",
246
+ price: 45000,
247
+ isActive: "y"
248
+ },
249
+ {
250
+ id: "id-Mazda",
251
+ mappingId: "car_table",
252
+ order: 6,
253
+ make: "Mazda",
254
+ model: "MX-5",
255
+ price: 36000,
256
+ isActive: "y"
257
+ },
258
+ {
259
+ id: "id-Mercedes",
260
+ mappingId: "car_table",
261
+ order: 7,
262
+ make: "Mercedes-Benz",
263
+ model: "Cabriolet",
264
+ price: 86000,
265
+ isActive: "y"
266
+ },
267
+ {
268
+ id: "id-Volkswagen",
269
+ mappingId: "car_table",
270
+ order: 9,
271
+ make: "Volkswagen",
272
+ model: "Beetle",
273
+ price: 68000,
274
+ isActive: "y"
275
+ },
276
+ {
277
+ id: "id-Honda",
278
+ mappingId: "car_table",
279
+ order: 10,
280
+ make: "Honda",
281
+ model: "City",
282
+ price: 69000,
283
+ isActive: "y"
284
+ },
285
+ {
286
+ id: "id-Volvo",
287
+ mappingId: "car_table",
288
+ order: 12,
289
+ make: "Volvo",
290
+ model: "S60",
291
+ price: 71000,
292
+ isActive: "y"
293
+ },
294
+ {
295
+ id: "id-Subaru",
296
+ mappingId: "car_table",
297
+ order: 3,
298
+ make: "Subaru",
299
+ model: "BRZ",
300
+ price: 48000,
301
+ isActive: "y"
302
+ }
303
+ ];
304
+ let keys3 = [
305
+ "id",
306
+ "mappingId",
307
+ "order",
308
+ "make",
309
+ "model",
310
+ "price",
311
+ "isActive"
312
+ ];
313
+ let kpHeadFilterType3 = {
314
+ //default: num (num,text,time,set)
315
+ id: "text",
316
+ mappingId: "text",
317
+ order: "num",
318
+ make: "text",
319
+ model: "text",
320
+ price: "num",
321
+ isActive: "text"
322
+ };
323
+ let rows3 = [
324
+ {
325
+ id: "",
326
+ mappingId: "",
327
+ order: 0,
328
+ make: "Toyota",
329
+ model: "Celica",
330
+ price: 35000
331
+ },
332
+ {
333
+ id: "",
334
+ mappingId: "",
335
+ order: 1,
336
+ make: "Ford",
337
+ model: "Mondeo",
338
+ price: 32000
339
+ },
340
+ {
341
+ id: "",
342
+ mappingId: "",
343
+ order: 2,
344
+ make: "Porsche",
345
+ model: "Boxter",
346
+ price: 72000
347
+ },
348
+ {
349
+ id: "",
350
+ mappingId: "",
351
+ order: 11,
352
+ make: "BMW",
353
+ model: "Sedan",
354
+ price: 66000
355
+ },
356
+ {
357
+ id: "",
358
+ mappingId: "",
359
+ order: 8,
360
+ make: "Nissan",
361
+ model: "March",
362
+ price: 61000
363
+ },
364
+ {
365
+ id: "",
366
+ mappingId: "",
367
+ order: 4,
368
+ make: "Lexus",
369
+ model: "RX",
370
+ price: 56000
371
+ },
372
+ {
373
+ id: "",
374
+ mappingId: "",
375
+ order: 5,
376
+ make: "Audi",
377
+ model: "A6 Allroad",
378
+ price: 45000
379
+ },
380
+ {
381
+ id: "",
382
+ mappingId: "",
383
+ order: 6,
384
+ make: "Mazda",
385
+ model: "MX-5",
386
+ price: 36000
387
+ },
388
+ {
389
+ id: "",
390
+ mappingId: "",
391
+ order: 7,
392
+ make: "Mercedes-Benz",
393
+ model: "Cabriolet",
394
+ price: 86000
395
+ },
396
+ {
397
+ id: "",
398
+ mappingId: "",
399
+ order: 9,
400
+ make: "Volkswagen",
401
+ model: "Beetle",
402
+ price: 68000
403
+ },
404
+ {
405
+ id: "",
406
+ mappingId: "",
407
+ order: 10,
408
+ make: "Honda",
409
+ model: "City",
410
+ price: 69000
411
+ },
412
+ {
413
+ id: "",
414
+ mappingId: "",
415
+ order: 12,
416
+ make: "Volvo",
417
+ model: "S60",
418
+ price: 71000
419
+ },
420
+ {
421
+ id: "",
422
+ mappingId: "",
423
+ order: 3,
424
+ make: "Subaru",
425
+ model: "BRZ",
426
+ price: 48000
427
+ }
428
+ ];
429
+ return {
430
+ WTableEdit: {
431
+ name: "Car Price",
432
+ description:
433
+ "The relationship between different car types and prices",
434
+ opt1: {
435
+ keys: keys1,
436
+ kpHeadFilterType: kpHeadFilterType1,
437
+ rows: rows1
438
+ },
439
+ opt2: {
440
+ keys: keys2,
441
+ kpHeadFilterType: kpHeadFilterType2,
442
+ rows: rows2
443
+ },
444
+ opt3: {
445
+ keys: keys2,
446
+ kpHeadFilterType: kpHeadFilterType2,
447
+ rows: rows2,
448
+ kpHead: {
449
+ id: "主鍵",
450
+ mappingId: "所屬主鍵",
451
+ order: "順序",
452
+ make: "Ecirp",
453
+ model: "Ledom",
454
+ price: "Ecirp",
455
+ isActive: "有效"
456
+ }
457
+ },
458
+ opt4: {
459
+ keys: keys2,
460
+ kpHeadFilterType: kpHeadFilterType2,
461
+ rows: rows2,
462
+ beforeAddRow: function(newRow) {
463
+ newRow.id = "id-random-" + Math.random();
464
+ return newRow;
465
+ }
466
+ },
467
+ opt5: {
468
+ keys: keys2,
469
+ kpHeadFilterType: kpHeadFilterType2,
470
+ rows: rows2,
471
+ kpConvertKeysWhenUploadData: {
472
+ makeTemp: "make",
473
+ modelTemp: "model",
474
+ priceTemp: "price"
475
+ }
476
+ },
477
+ opt6: {
478
+ keys: keys2,
479
+ rows: rows2,
480
+ optForUploadData: {
481
+ //input for uploadData in w-aggrid-vue, https://github.com/yuda-lyu/w-aggrid-vue
482
+ beforeUpload: null,
483
+ parseSheetInd: 1 //取第2個sheet, 預設0(取第1個sheet)
484
+ }
485
+ },
486
+ opt7: {
487
+ keys: keys3,
488
+ kpHeadFilterType: kpHeadFilterType3,
489
+ rows: rows3,
490
+ modifyDataWhenSave: function(rows) {
491
+ console.log("modifyDataWhenSave", rows);
492
+ for (let k = 0; k < rows.length; k++) {
493
+ let v = rows[k];
494
+ v.id = "id-random-" + Math.random();
495
+ v.mappingId = "auto_car_table";
496
+ v.order = k;
497
+ v.isActive = "y";
498
+ }
499
+ return rows;
500
+ }
501
+ }
502
+ },
503
+ actions: []
504
+ };
505
+ },
506
+ mounted: function() {
507
+ return {};
508
+ },
509
+ computed: {},
510
+ methods: {
511
+ evSuccess: function(msg) {
512
+ console.log("evSuccess:", msg);
513
+ },
514
+ evError: function(msg) {
515
+ console.log("evError:", msg);
516
+ },
517
+ saveData: function() {
518
+ let data = this.$refs.table.save();
519
+ document.querySelector("#disp-save-data").innerHTML = JSON.stringify(
520
+ data,
521
+ null,
522
+ 2
523
+ );
524
+ console.log("saveData:", data);
525
+ }
526
+ }
527
+ });
528
+ </script>
529
+ </body>
530
+ </html>