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