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