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