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