w-table-vue 1.0.0

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 (89) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +55 -0
  4. package/.jsdoc +25 -0
  5. package/LICENSE +21 -0
  6. package/README.md +109 -0
  7. package/SECURITY.md +5 -0
  8. package/babel.config.js +16 -0
  9. package/dist/w-table-vue.umd.js +7 -0
  10. package/dist/w-table-vue.umd.js.map +1 -0
  11. package/docs/examples/app.html +63 -0
  12. package/docs/examples/app.umd.js +7 -0
  13. package/docs/examples/app.umd.js.map +1 -0
  14. package/docs/examples/w-table-edit_default.html +525 -0
  15. package/docs/examples/w-table-edit_editable.html +528 -0
  16. package/docs/examples/w-table-edit_editable_checkId.html +529 -0
  17. package/docs/examples/w-table-edit_editable_checkId_opt.modifyDataWhenSave_save(call cmp. method).html +544 -0
  18. package/docs/examples/w-table-edit_editable_checkId_successMsgFromAddRow_errorMsgFromAddRow.html +539 -0
  19. package/docs/examples/w-table-edit_editable_inforPaddingStyle_menuBackgroundColor.html +534 -0
  20. package/docs/examples/w-table-edit_editable_language_checkId_tooltipAddRow.html +540 -0
  21. package/docs/examples/w-table-edit_editable_language_textLabelDataName_textPlaceholderDataName.html +535 -0
  22. package/docs/examples/w-table-edit_editable_no enableInfor.html +529 -0
  23. package/docs/examples/w-table-edit_editable_no enableMenu.html +529 -0
  24. package/docs/examples/w-table-edit_editable_opt.beforeAddRow.html +528 -0
  25. package/docs/examples/w-table-edit_editable_opt.kpConvertKeysWhenUploadData.html +528 -0
  26. package/docs/examples/w-table-edit_editable_opt.optForUploadData.html +528 -0
  27. package/docs/examples/w-table-edit_editable_slot btns-right.html +552 -0
  28. package/docs/examples/w-table-edit_fixIds (fix id).html +529 -0
  29. package/docs/examples/w-table-edit_hideIds (hide mappingId).html +529 -0
  30. package/docs/examples/w-table-edit_name_description.html +527 -0
  31. package/docs/examples/w-table-edit_no enableInfor.html +528 -0
  32. package/docs/examples/w-table-edit_no enableMenu.html +528 -0
  33. package/docs/examples/w-table-edit_opt.kpHead.html +527 -0
  34. package/docs/examples/w-table-edit_removeIdsWhenDownload (remove id, mappingId, order, isActive).html +530 -0
  35. package/docs/examples/w-table-edit_slot btns-left.html +551 -0
  36. package/docs/examples/w-table-edit_slot btns-right.html +551 -0
  37. package/docs/examples/w-table-edit_slot infor (name_description).html +544 -0
  38. package/docs/examples/w-table-edit_sortColIds (sort by order).html +528 -0
  39. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  40. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  41. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  42. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  43. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  44. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  45. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  46. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  47. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  48. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  49. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  50. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  51. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  52. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  53. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  54. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  55. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  56. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  57. package/docs/index.html +84 -0
  58. package/docs/module-WTableEdit.html +1486 -0
  59. package/docs/scripts/collapse.js +39 -0
  60. package/docs/scripts/commonNav.js +28 -0
  61. package/docs/scripts/linenumber.js +25 -0
  62. package/docs/scripts/nav.js +12 -0
  63. package/docs/scripts/polyfill.js +4 -0
  64. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  65. package/docs/scripts/prettify/lang-css.js +2 -0
  66. package/docs/scripts/prettify/prettify.js +28 -0
  67. package/docs/scripts/search.js +99 -0
  68. package/docs/styles/jsdoc.css +776 -0
  69. package/docs/styles/prettify.css +80 -0
  70. package/package.json +66 -0
  71. package/public/index.html +25 -0
  72. package/script.txt +24 -0
  73. package/src/App.vue +322 -0
  74. package/src/AppZoneWTableEdit.vue +740 -0
  75. package/src/components/WTableEdit.vue +1278 -0
  76. package/src/components/WTableVue.vue +12 -0
  77. package/src/components/demolink.vue +105 -0
  78. package/src/main.js +8 -0
  79. package/test/all.test.mjs +10 -0
  80. package/toolg/addVersion.mjs +4 -0
  81. package/toolg/cleanFolder.mjs +5 -0
  82. package/toolg/cvCasename.mjs +43 -0
  83. package/toolg/gDistApp.mjs +38 -0
  84. package/toolg/gDistRollupComps.mjs +23 -0
  85. package/toolg/gDocExams.mjs +47 -0
  86. package/toolg/gExtractHtml.mjs +268 -0
  87. package/toolg/gMergeComps.mjs +75 -0
  88. package/toolg/modifyReadme.mjs +4 -0
  89. package/vue.config.js +9 -0
@@ -0,0 +1,552 @@
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
+ <!-- xlsx, w-aggrid-vue的download與upload會使用 -->
46
+ <script
47
+ src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"
48
+ ></script>
49
+
50
+ <!-- ag-grid, ag-grid-vue無法被rollup編譯, 須由cdn引入, 且其依賴window.agGrid -->
51
+ <script
52
+ src="https://cdn.jsdelivr.net/npm/ag-grid-community@31.3.4/dist/ag-grid-community.min.noStyle.js"
53
+ ></script>
54
+ <script
55
+ src="https://cdn.jsdelivr.net/npm/ag-grid-vue@31.3.4/dist/ag-grid-vue.umd.min.js"
56
+ ></script>
57
+
58
+ <!-- w-table-vue -->
59
+ <script src="https://cdn.jsdelivr.net/npm/w-table-vue@1.0.0/dist/w-table-vue.umd.js"></script>
60
+
61
+ <style>
62
+ .item {
63
+ /* 因item位於demolink, 提取各範例html後會刪除demolink, 故得額外補上 */
64
+ border-left: 3px solid #ffba75;
65
+ margin: 5px 5px 8px 0px;
66
+ padding: 3px 3px 5px 10px;
67
+ font-size: 0.9rem;
68
+ display: flex;
69
+ justify-content: flex-start;
70
+ align-items: center;
71
+ }
72
+ .head1 {
73
+ padding: 0px 0px 20px 0px;
74
+ font-size: 2.5rem;
75
+ }
76
+ .bkh {
77
+ /* 寬 */
78
+ padding: 20px;
79
+ }
80
+ @media screen and (max-width: 800px) {
81
+ /* 中 */
82
+ .bkh {
83
+ padding: 10px;
84
+ }
85
+ }
86
+ @media screen and (max-width: 400px) {
87
+ /* 窄 */
88
+ .bkh {
89
+ padding: 5px;
90
+ }
91
+ }
92
+ .bk {
93
+ /* 寬 */
94
+ display: inline-block;
95
+ vertical-align: top;
96
+ padding: 0px 80px 60px 0px;
97
+ }
98
+ @media screen and (max-width: 1000px) {
99
+ /* 中窄 */
100
+ .bk {
101
+ display: block;
102
+ padding: 0px 0px 50px 0px;
103
+ }
104
+ }
105
+ </style>
106
+ </head>
107
+ <body
108
+ style="font-family:'Microsoft JhengHei','Avenir','Helvetica'; padding:0px; margin:0px;"
109
+ >
110
+ <div id="app" class="bkh" style>
111
+ <div class="head1">
112
+ <span
113
+ style="cursor:pointer;"
114
+ title="open for copy link to view component"
115
+ onclick="window.open('//yuda-lyu.github.io/w-table-vue/examples/app.html?cmp='+this.innerText,'_blank')"
116
+ >w-table-edit</span>
117
+ </div>
118
+ <div class="bk">
119
+ <div class="item">editable &amp; slot btns-right</div>
120
+
121
+ <w-table-edit
122
+ style="width:600px; height:400px;"
123
+ :name="WTableEdit.name"
124
+ :description="WTableEdit.description"
125
+ :opt="WTableEdit.opt1"
126
+ :editable="true"
127
+ @success="evSuccess"
128
+ @error="evError"
129
+ >
130
+ <template v-slot:btns-right="props">
131
+ <select
132
+ style="padding:0px 10px; background:rgba(255,255,255,0.1); color:#666; font-size:0.7rem; border:1px solid rgba(0,0,0,0.3); border-radius:30px; outline:none;"
133
+ >
134
+ <option
135
+ style="color:#666; font-size:0.7rem;"
136
+ value="0"
137
+ >Select Item</option>
138
+ <option
139
+ style="color:#666; font-size:0.7rem;"
140
+ value="1"
141
+ >Quisquam</option>
142
+ <option
143
+ style="color:#666; font-size:0.7rem;"
144
+ value="2"
145
+ >Dolorem</option>
146
+ <option
147
+ :style="`${props.editable?'color:#666;':'color:#aaa;'} font-size:0.7rem;`"
148
+ value="3"
149
+ :disabled="!props.editable"
150
+ >Ipsum</option>
151
+ </select>
152
+ </template>
153
+ </w-table-edit>
154
+ </div>
155
+ </div>
156
+
157
+ <script>
158
+ //install
159
+ Vue.use(window["w-table-vue"]);
160
+
161
+ //initialize
162
+ new Vue({
163
+ el: "#app",
164
+
165
+ data: function() {
166
+ let keys1 = ["make", "model", "price"];
167
+ let kpHeadFilterType1 = {
168
+ //default: num (num,text,time,set)
169
+ make: "text",
170
+ model: "text",
171
+ price: "num"
172
+ };
173
+ let rows1 = [
174
+ { make: "Toyota", model: "Celica", price: 35000 },
175
+ { make: "Ford", model: "Mondeo", price: 32000 },
176
+ { make: "Porsche", model: "Boxter", price: 72000 },
177
+ { make: "BMW", model: "Sedan", price: 66000 },
178
+ { make: "Nissan", model: "March", price: 61000 },
179
+ { make: "Lexus", model: "RX", price: 56000 },
180
+ { make: "Audi", model: "A6 Allroad", price: 45000 },
181
+ { make: "Mazda", model: "MX-5", price: 36000 },
182
+ { make: "Mercedes-Benz", model: "Cabriolet", price: 86000 },
183
+ { make: "Volkswagen", model: "Beetle", price: 68000 },
184
+ { make: "Honda", model: "City", price: 69000 },
185
+ { make: "Volvo", model: "S60", price: 71000 },
186
+ { make: "Subaru", model: "BRZ", price: 48000 }
187
+ ];
188
+ let keys2 = [
189
+ "id",
190
+ "mappingId",
191
+ "order",
192
+ "make",
193
+ "model",
194
+ "price",
195
+ "isActive"
196
+ ];
197
+ let kpHeadFilterType2 = {
198
+ //default: num (num,text,time,set)
199
+ id: "text",
200
+ mappingId: "text",
201
+ order: "num",
202
+ make: "text",
203
+ model: "text",
204
+ price: "num",
205
+ isActive: "text"
206
+ };
207
+ let rows2 = [
208
+ {
209
+ id: "id-Toyota",
210
+ mappingId: "car_table",
211
+ order: 0,
212
+ make: "Toyota",
213
+ model: "Celica",
214
+ price: 35000,
215
+ isActive: "y"
216
+ },
217
+ {
218
+ id: "id-Ford",
219
+ mappingId: "car_table",
220
+ order: 1,
221
+ make: "Ford",
222
+ model: "Mondeo",
223
+ price: 32000,
224
+ isActive: "y"
225
+ },
226
+ {
227
+ id: "id-Porsche",
228
+ mappingId: "car_table",
229
+ order: 2,
230
+ make: "Porsche",
231
+ model: "Boxter",
232
+ price: 72000,
233
+ isActive: "y"
234
+ },
235
+ {
236
+ id: "id-BMW",
237
+ mappingId: "car_table",
238
+ order: 11,
239
+ make: "BMW",
240
+ model: "Sedan",
241
+ price: 66000,
242
+ isActive: "y"
243
+ },
244
+ {
245
+ id: "id-Nissan",
246
+ mappingId: "car_table",
247
+ order: 8,
248
+ make: "Nissan",
249
+ model: "March",
250
+ price: 61000,
251
+ isActive: "y"
252
+ },
253
+ {
254
+ id: "id-Lexus",
255
+ mappingId: "car_table",
256
+ order: 4,
257
+ make: "Lexus",
258
+ model: "RX",
259
+ price: 56000,
260
+ isActive: "y"
261
+ },
262
+ {
263
+ id: "id-Audi",
264
+ mappingId: "car_table",
265
+ order: 5,
266
+ make: "Audi",
267
+ model: "A6 Allroad",
268
+ price: 45000,
269
+ isActive: "y"
270
+ },
271
+ {
272
+ id: "id-Mazda",
273
+ mappingId: "car_table",
274
+ order: 6,
275
+ make: "Mazda",
276
+ model: "MX-5",
277
+ price: 36000,
278
+ isActive: "y"
279
+ },
280
+ {
281
+ id: "id-Mercedes",
282
+ mappingId: "car_table",
283
+ order: 7,
284
+ make: "Mercedes-Benz",
285
+ model: "Cabriolet",
286
+ price: 86000,
287
+ isActive: "y"
288
+ },
289
+ {
290
+ id: "id-Volkswagen",
291
+ mappingId: "car_table",
292
+ order: 9,
293
+ make: "Volkswagen",
294
+ model: "Beetle",
295
+ price: 68000,
296
+ isActive: "y"
297
+ },
298
+ {
299
+ id: "id-Honda",
300
+ mappingId: "car_table",
301
+ order: 10,
302
+ make: "Honda",
303
+ model: "City",
304
+ price: 69000,
305
+ isActive: "y"
306
+ },
307
+ {
308
+ id: "id-Volvo",
309
+ mappingId: "car_table",
310
+ order: 12,
311
+ make: "Volvo",
312
+ model: "S60",
313
+ price: 71000,
314
+ isActive: "y"
315
+ },
316
+ {
317
+ id: "id-Subaru",
318
+ mappingId: "car_table",
319
+ order: 3,
320
+ make: "Subaru",
321
+ model: "BRZ",
322
+ price: 48000,
323
+ isActive: "y"
324
+ }
325
+ ];
326
+ let keys3 = [
327
+ "id",
328
+ "mappingId",
329
+ "order",
330
+ "make",
331
+ "model",
332
+ "price",
333
+ "isActive"
334
+ ];
335
+ let kpHeadFilterType3 = {
336
+ //default: num (num,text,time,set)
337
+ id: "text",
338
+ mappingId: "text",
339
+ order: "num",
340
+ make: "text",
341
+ model: "text",
342
+ price: "num",
343
+ isActive: "text"
344
+ };
345
+ let rows3 = [
346
+ {
347
+ id: "",
348
+ mappingId: "",
349
+ order: 0,
350
+ make: "Toyota",
351
+ model: "Celica",
352
+ price: 35000
353
+ },
354
+ {
355
+ id: "",
356
+ mappingId: "",
357
+ order: 1,
358
+ make: "Ford",
359
+ model: "Mondeo",
360
+ price: 32000
361
+ },
362
+ {
363
+ id: "",
364
+ mappingId: "",
365
+ order: 2,
366
+ make: "Porsche",
367
+ model: "Boxter",
368
+ price: 72000
369
+ },
370
+ {
371
+ id: "",
372
+ mappingId: "",
373
+ order: 11,
374
+ make: "BMW",
375
+ model: "Sedan",
376
+ price: 66000
377
+ },
378
+ {
379
+ id: "",
380
+ mappingId: "",
381
+ order: 8,
382
+ make: "Nissan",
383
+ model: "March",
384
+ price: 61000
385
+ },
386
+ {
387
+ id: "",
388
+ mappingId: "",
389
+ order: 4,
390
+ make: "Lexus",
391
+ model: "RX",
392
+ price: 56000
393
+ },
394
+ {
395
+ id: "",
396
+ mappingId: "",
397
+ order: 5,
398
+ make: "Audi",
399
+ model: "A6 Allroad",
400
+ price: 45000
401
+ },
402
+ {
403
+ id: "",
404
+ mappingId: "",
405
+ order: 6,
406
+ make: "Mazda",
407
+ model: "MX-5",
408
+ price: 36000
409
+ },
410
+ {
411
+ id: "",
412
+ mappingId: "",
413
+ order: 7,
414
+ make: "Mercedes-Benz",
415
+ model: "Cabriolet",
416
+ price: 86000
417
+ },
418
+ {
419
+ id: "",
420
+ mappingId: "",
421
+ order: 9,
422
+ make: "Volkswagen",
423
+ model: "Beetle",
424
+ price: 68000
425
+ },
426
+ {
427
+ id: "",
428
+ mappingId: "",
429
+ order: 10,
430
+ make: "Honda",
431
+ model: "City",
432
+ price: 69000
433
+ },
434
+ {
435
+ id: "",
436
+ mappingId: "",
437
+ order: 12,
438
+ make: "Volvo",
439
+ model: "S60",
440
+ price: 71000
441
+ },
442
+ {
443
+ id: "",
444
+ mappingId: "",
445
+ order: 3,
446
+ make: "Subaru",
447
+ model: "BRZ",
448
+ price: 48000
449
+ }
450
+ ];
451
+ return {
452
+ WTableEdit: {
453
+ name: "Car Price",
454
+ description:
455
+ "The relationship between different car types and prices",
456
+ opt1: {
457
+ keys: keys1,
458
+ kpHeadFilterType: kpHeadFilterType1,
459
+ rows: rows1
460
+ },
461
+ opt2: {
462
+ keys: keys2,
463
+ kpHeadFilterType: kpHeadFilterType2,
464
+ rows: rows2
465
+ },
466
+ opt3: {
467
+ keys: keys2,
468
+ kpHeadFilterType: kpHeadFilterType2,
469
+ rows: rows2,
470
+ kpHead: {
471
+ id: "主鍵",
472
+ mappingId: "所屬主鍵",
473
+ order: "順序",
474
+ make: "Ecirp",
475
+ model: "Ledom",
476
+ price: "Ecirp",
477
+ isActive: "有效"
478
+ }
479
+ },
480
+ opt4: {
481
+ keys: keys2,
482
+ kpHeadFilterType: kpHeadFilterType2,
483
+ rows: rows2,
484
+ beforeAddRow: function(newRow) {
485
+ newRow.id = "id-random-" + Math.random();
486
+ return newRow;
487
+ }
488
+ },
489
+ opt5: {
490
+ keys: keys2,
491
+ kpHeadFilterType: kpHeadFilterType2,
492
+ rows: rows2,
493
+ kpConvertKeysWhenUploadData: {
494
+ makeTemp: "make",
495
+ modelTemp: "model",
496
+ priceTemp: "price"
497
+ }
498
+ },
499
+ opt6: {
500
+ keys: keys2,
501
+ rows: rows2,
502
+ optForUploadData: {
503
+ //input for uploadData in w-aggrid-vue, https://github.com/yuda-lyu/w-aggrid-vue
504
+ beforeUpload: null,
505
+ parseSheetInd: 1 //取第2個sheet, 預設0(取第1個sheet)
506
+ }
507
+ },
508
+ opt7: {
509
+ keys: keys3,
510
+ kpHeadFilterType: kpHeadFilterType3,
511
+ rows: rows3,
512
+ modifyDataWhenSave: function(rows) {
513
+ console.log("modifyDataWhenSave", rows);
514
+ for (let k = 0; k < rows.length; k++) {
515
+ let v = rows[k];
516
+ v.id = "id-random-" + Math.random();
517
+ v.mappingId = "auto_car_table";
518
+ v.order = k;
519
+ v.isActive = "y";
520
+ }
521
+ return rows;
522
+ }
523
+ }
524
+ },
525
+ actions: []
526
+ };
527
+ },
528
+ mounted: function() {
529
+ return {};
530
+ },
531
+ computed: {},
532
+ methods: {
533
+ evSuccess: function(msg) {
534
+ console.log("evSuccess:", msg);
535
+ },
536
+ evError: function(msg) {
537
+ console.log("evError:", msg);
538
+ },
539
+ saveData: function() {
540
+ let data = this.$refs.table.save();
541
+ document.querySelector("#disp-save-data").innerHTML = JSON.stringify(
542
+ data,
543
+ null,
544
+ 2
545
+ );
546
+ console.log("saveData:", data);
547
+ }
548
+ }
549
+ });
550
+ </script>
551
+ </body>
552
+ </html>