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,539 @@
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
120
+ class="item"
121
+ >editable &amp; checkId &amp; successMsgFromAddRow &amp; errorMsgFromAddRow &amp; errorMsgFromRemoveRow &amp; errorMsgFromUploadEmptyData &amp; errorMsgFromUploadData &amp; successMsgFromDownloadData &amp; errorMsgFromDownloadData</div>
122
+
123
+ <w-table-edit
124
+ style="width:600px; height:400px;"
125
+ :name="WTableEdit.name"
126
+ :description="WTableEdit.description"
127
+ :opt="WTableEdit.opt2"
128
+ :editable="true"
129
+ :check-id="'id'"
130
+ :success-msg-from-add-row="'新增數據成功'"
131
+ :error-msg-from-add-row="'無法新增數據'"
132
+ :error-msg-from-remove-row="'移除數據失敗'"
133
+ :success-msg-from-upload-data="'上傳數據成功'"
134
+ :error-msg-from-upload-data="'無法上傳數據'"
135
+ :error-msg-from-upload-empty-data="'上傳檔案中無有效數據'"
136
+ :success-msg-from-download-data="'下載檔案成功'"
137
+ :error-msg-from-download-data="'無法下載檔案'"
138
+ @success="evSuccess"
139
+ @error="evError"
140
+ ></w-table-edit>
141
+ </div>
142
+ </div>
143
+
144
+ <script>
145
+ //install
146
+ Vue.use(window["w-table-vue"]);
147
+
148
+ //initialize
149
+ new Vue({
150
+ el: "#app",
151
+
152
+ data: function() {
153
+ let keys1 = ["make", "model", "price"];
154
+ let kpHeadFilterType1 = {
155
+ //default: num (num,text,time,set)
156
+ make: "text",
157
+ model: "text",
158
+ price: "num"
159
+ };
160
+ let rows1 = [
161
+ { make: "Toyota", model: "Celica", price: 35000 },
162
+ { make: "Ford", model: "Mondeo", price: 32000 },
163
+ { make: "Porsche", model: "Boxter", price: 72000 },
164
+ { make: "BMW", model: "Sedan", price: 66000 },
165
+ { make: "Nissan", model: "March", price: 61000 },
166
+ { make: "Lexus", model: "RX", price: 56000 },
167
+ { make: "Audi", model: "A6 Allroad", price: 45000 },
168
+ { make: "Mazda", model: "MX-5", price: 36000 },
169
+ { make: "Mercedes-Benz", model: "Cabriolet", price: 86000 },
170
+ { make: "Volkswagen", model: "Beetle", price: 68000 },
171
+ { make: "Honda", model: "City", price: 69000 },
172
+ { make: "Volvo", model: "S60", price: 71000 },
173
+ { make: "Subaru", model: "BRZ", price: 48000 }
174
+ ];
175
+ let keys2 = [
176
+ "id",
177
+ "mappingId",
178
+ "order",
179
+ "make",
180
+ "model",
181
+ "price",
182
+ "isActive"
183
+ ];
184
+ let kpHeadFilterType2 = {
185
+ //default: num (num,text,time,set)
186
+ id: "text",
187
+ mappingId: "text",
188
+ order: "num",
189
+ make: "text",
190
+ model: "text",
191
+ price: "num",
192
+ isActive: "text"
193
+ };
194
+ let rows2 = [
195
+ {
196
+ id: "id-Toyota",
197
+ mappingId: "car_table",
198
+ order: 0,
199
+ make: "Toyota",
200
+ model: "Celica",
201
+ price: 35000,
202
+ isActive: "y"
203
+ },
204
+ {
205
+ id: "id-Ford",
206
+ mappingId: "car_table",
207
+ order: 1,
208
+ make: "Ford",
209
+ model: "Mondeo",
210
+ price: 32000,
211
+ isActive: "y"
212
+ },
213
+ {
214
+ id: "id-Porsche",
215
+ mappingId: "car_table",
216
+ order: 2,
217
+ make: "Porsche",
218
+ model: "Boxter",
219
+ price: 72000,
220
+ isActive: "y"
221
+ },
222
+ {
223
+ id: "id-BMW",
224
+ mappingId: "car_table",
225
+ order: 11,
226
+ make: "BMW",
227
+ model: "Sedan",
228
+ price: 66000,
229
+ isActive: "y"
230
+ },
231
+ {
232
+ id: "id-Nissan",
233
+ mappingId: "car_table",
234
+ order: 8,
235
+ make: "Nissan",
236
+ model: "March",
237
+ price: 61000,
238
+ isActive: "y"
239
+ },
240
+ {
241
+ id: "id-Lexus",
242
+ mappingId: "car_table",
243
+ order: 4,
244
+ make: "Lexus",
245
+ model: "RX",
246
+ price: 56000,
247
+ isActive: "y"
248
+ },
249
+ {
250
+ id: "id-Audi",
251
+ mappingId: "car_table",
252
+ order: 5,
253
+ make: "Audi",
254
+ model: "A6 Allroad",
255
+ price: 45000,
256
+ isActive: "y"
257
+ },
258
+ {
259
+ id: "id-Mazda",
260
+ mappingId: "car_table",
261
+ order: 6,
262
+ make: "Mazda",
263
+ model: "MX-5",
264
+ price: 36000,
265
+ isActive: "y"
266
+ },
267
+ {
268
+ id: "id-Mercedes",
269
+ mappingId: "car_table",
270
+ order: 7,
271
+ make: "Mercedes-Benz",
272
+ model: "Cabriolet",
273
+ price: 86000,
274
+ isActive: "y"
275
+ },
276
+ {
277
+ id: "id-Volkswagen",
278
+ mappingId: "car_table",
279
+ order: 9,
280
+ make: "Volkswagen",
281
+ model: "Beetle",
282
+ price: 68000,
283
+ isActive: "y"
284
+ },
285
+ {
286
+ id: "id-Honda",
287
+ mappingId: "car_table",
288
+ order: 10,
289
+ make: "Honda",
290
+ model: "City",
291
+ price: 69000,
292
+ isActive: "y"
293
+ },
294
+ {
295
+ id: "id-Volvo",
296
+ mappingId: "car_table",
297
+ order: 12,
298
+ make: "Volvo",
299
+ model: "S60",
300
+ price: 71000,
301
+ isActive: "y"
302
+ },
303
+ {
304
+ id: "id-Subaru",
305
+ mappingId: "car_table",
306
+ order: 3,
307
+ make: "Subaru",
308
+ model: "BRZ",
309
+ price: 48000,
310
+ isActive: "y"
311
+ }
312
+ ];
313
+ let keys3 = [
314
+ "id",
315
+ "mappingId",
316
+ "order",
317
+ "make",
318
+ "model",
319
+ "price",
320
+ "isActive"
321
+ ];
322
+ let kpHeadFilterType3 = {
323
+ //default: num (num,text,time,set)
324
+ id: "text",
325
+ mappingId: "text",
326
+ order: "num",
327
+ make: "text",
328
+ model: "text",
329
+ price: "num",
330
+ isActive: "text"
331
+ };
332
+ let rows3 = [
333
+ {
334
+ id: "",
335
+ mappingId: "",
336
+ order: 0,
337
+ make: "Toyota",
338
+ model: "Celica",
339
+ price: 35000
340
+ },
341
+ {
342
+ id: "",
343
+ mappingId: "",
344
+ order: 1,
345
+ make: "Ford",
346
+ model: "Mondeo",
347
+ price: 32000
348
+ },
349
+ {
350
+ id: "",
351
+ mappingId: "",
352
+ order: 2,
353
+ make: "Porsche",
354
+ model: "Boxter",
355
+ price: 72000
356
+ },
357
+ {
358
+ id: "",
359
+ mappingId: "",
360
+ order: 11,
361
+ make: "BMW",
362
+ model: "Sedan",
363
+ price: 66000
364
+ },
365
+ {
366
+ id: "",
367
+ mappingId: "",
368
+ order: 8,
369
+ make: "Nissan",
370
+ model: "March",
371
+ price: 61000
372
+ },
373
+ {
374
+ id: "",
375
+ mappingId: "",
376
+ order: 4,
377
+ make: "Lexus",
378
+ model: "RX",
379
+ price: 56000
380
+ },
381
+ {
382
+ id: "",
383
+ mappingId: "",
384
+ order: 5,
385
+ make: "Audi",
386
+ model: "A6 Allroad",
387
+ price: 45000
388
+ },
389
+ {
390
+ id: "",
391
+ mappingId: "",
392
+ order: 6,
393
+ make: "Mazda",
394
+ model: "MX-5",
395
+ price: 36000
396
+ },
397
+ {
398
+ id: "",
399
+ mappingId: "",
400
+ order: 7,
401
+ make: "Mercedes-Benz",
402
+ model: "Cabriolet",
403
+ price: 86000
404
+ },
405
+ {
406
+ id: "",
407
+ mappingId: "",
408
+ order: 9,
409
+ make: "Volkswagen",
410
+ model: "Beetle",
411
+ price: 68000
412
+ },
413
+ {
414
+ id: "",
415
+ mappingId: "",
416
+ order: 10,
417
+ make: "Honda",
418
+ model: "City",
419
+ price: 69000
420
+ },
421
+ {
422
+ id: "",
423
+ mappingId: "",
424
+ order: 12,
425
+ make: "Volvo",
426
+ model: "S60",
427
+ price: 71000
428
+ },
429
+ {
430
+ id: "",
431
+ mappingId: "",
432
+ order: 3,
433
+ make: "Subaru",
434
+ model: "BRZ",
435
+ price: 48000
436
+ }
437
+ ];
438
+ return {
439
+ WTableEdit: {
440
+ name: "Car Price",
441
+ description:
442
+ "The relationship between different car types and prices",
443
+ opt1: {
444
+ keys: keys1,
445
+ kpHeadFilterType: kpHeadFilterType1,
446
+ rows: rows1
447
+ },
448
+ opt2: {
449
+ keys: keys2,
450
+ kpHeadFilterType: kpHeadFilterType2,
451
+ rows: rows2
452
+ },
453
+ opt3: {
454
+ keys: keys2,
455
+ kpHeadFilterType: kpHeadFilterType2,
456
+ rows: rows2,
457
+ kpHead: {
458
+ id: "主鍵",
459
+ mappingId: "所屬主鍵",
460
+ order: "順序",
461
+ make: "Ecirp",
462
+ model: "Ledom",
463
+ price: "Ecirp",
464
+ isActive: "有效"
465
+ }
466
+ },
467
+ opt4: {
468
+ keys: keys2,
469
+ kpHeadFilterType: kpHeadFilterType2,
470
+ rows: rows2,
471
+ beforeAddRow: function(newRow) {
472
+ newRow.id = "id-random-" + Math.random();
473
+ return newRow;
474
+ }
475
+ },
476
+ opt5: {
477
+ keys: keys2,
478
+ kpHeadFilterType: kpHeadFilterType2,
479
+ rows: rows2,
480
+ kpConvertKeysWhenUploadData: {
481
+ makeTemp: "make",
482
+ modelTemp: "model",
483
+ priceTemp: "price"
484
+ }
485
+ },
486
+ opt6: {
487
+ keys: keys2,
488
+ rows: rows2,
489
+ optForUploadData: {
490
+ //input for uploadData in w-aggrid-vue, https://github.com/yuda-lyu/w-aggrid-vue
491
+ beforeUpload: null,
492
+ parseSheetInd: 1 //取第2個sheet, 預設0(取第1個sheet)
493
+ }
494
+ },
495
+ opt7: {
496
+ keys: keys3,
497
+ kpHeadFilterType: kpHeadFilterType3,
498
+ rows: rows3,
499
+ modifyDataWhenSave: function(rows) {
500
+ console.log("modifyDataWhenSave", rows);
501
+ for (let k = 0; k < rows.length; k++) {
502
+ let v = rows[k];
503
+ v.id = "id-random-" + Math.random();
504
+ v.mappingId = "auto_car_table";
505
+ v.order = k;
506
+ v.isActive = "y";
507
+ }
508
+ return rows;
509
+ }
510
+ }
511
+ },
512
+ actions: []
513
+ };
514
+ },
515
+ mounted: function() {
516
+ return {};
517
+ },
518
+ computed: {},
519
+ methods: {
520
+ evSuccess: function(msg) {
521
+ console.log("evSuccess:", msg);
522
+ },
523
+ evError: function(msg) {
524
+ console.log("evError:", msg);
525
+ },
526
+ saveData: function() {
527
+ let data = this.$refs.table.save();
528
+ document.querySelector("#disp-save-data").innerHTML = JSON.stringify(
529
+ data,
530
+ null,
531
+ 2
532
+ );
533
+ console.log("saveData:", data);
534
+ }
535
+ }
536
+ });
537
+ </script>
538
+ </body>
539
+ </html>