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,740 @@
1
+ <template>
2
+ <div class="bkh">
3
+
4
+
5
+ <div class="head1"><span style="cursor:pointer;" title="open for copy link to view component" onclick="window.open('//yuda-lyu.github.io/w-table-vue/examples/app.html?cmp='+this.innerText,'_blank')">w-table-edit</span></div>
6
+
7
+
8
+ <div>
9
+
10
+
11
+ <div class="bk">
12
+ <demolink
13
+ :kbname="'w-table-edit'"
14
+ :casename="'default'"
15
+ ></demolink>
16
+
17
+ <w-table-edit
18
+ style="width:600px; height:400px;"
19
+ :opt="WTableEdit.opt1"
20
+ @success="evSuccess"
21
+ @error="evError"
22
+ ></w-table-edit>
23
+
24
+ </div>
25
+
26
+
27
+ <div class="bk">
28
+ <demolink
29
+ :kbname="'w-table-edit'"
30
+ :casename="'name & description'"
31
+ ></demolink>
32
+
33
+ <w-table-edit
34
+ style="width:600px; height:400px;"
35
+ :name="WTableEdit.name"
36
+ :description="WTableEdit.description"
37
+ :opt="WTableEdit.opt1"
38
+ @success="evSuccess"
39
+ @error="evError"
40
+ ></w-table-edit>
41
+
42
+ </div>
43
+
44
+
45
+ <div class="bk">
46
+ <demolink
47
+ :kbname="'w-table-edit'"
48
+ :casename="'no enableInfor'"
49
+ ></demolink>
50
+
51
+ <w-table-edit
52
+ style="width:600px; height:400px;"
53
+ :enableInfor="false"
54
+ :name="WTableEdit.name"
55
+ :description="WTableEdit.description"
56
+ :opt="WTableEdit.opt1"
57
+ @success="evSuccess"
58
+ @error="evError"
59
+ ></w-table-edit>
60
+
61
+ </div>
62
+
63
+
64
+ <div class="bk">
65
+ <demolink
66
+ :kbname="'w-table-edit'"
67
+ :casename="'no enableMenu'"
68
+ ></demolink>
69
+
70
+ <w-table-edit
71
+ style="width:600px; height:400px;"
72
+ :enableMenu="false"
73
+ :name="WTableEdit.name"
74
+ :description="WTableEdit.description"
75
+ :opt="WTableEdit.opt1"
76
+ @success="evSuccess"
77
+ @error="evError"
78
+ ></w-table-edit>
79
+
80
+ </div>
81
+
82
+
83
+ <div class="bk">
84
+ <demolink
85
+ :kbname="'w-table-edit'"
86
+ :casename="'opt.kpHead'"
87
+ ></demolink>
88
+
89
+ <w-table-edit
90
+ style="width:600px; height:400px;"
91
+ :name="WTableEdit.name"
92
+ :description="WTableEdit.description"
93
+ :opt="WTableEdit.opt3"
94
+ @success="evSuccess"
95
+ @error="evError"
96
+ ></w-table-edit>
97
+
98
+ </div>
99
+
100
+
101
+ <div class="bk">
102
+ <demolink
103
+ :kbname="'w-table-edit'"
104
+ :casename="'sortColIds (sort by order)'"
105
+ ></demolink>
106
+
107
+ <w-table-edit
108
+ style="width:600px; height:400px;"
109
+ :name="WTableEdit.name"
110
+ :description="WTableEdit.description"
111
+ :opt="WTableEdit.opt2"
112
+ :sortColIds="'order'"
113
+ @success="evSuccess"
114
+ @error="evError"
115
+ ></w-table-edit>
116
+
117
+ </div>
118
+
119
+
120
+ <div class="bk">
121
+ <demolink
122
+ :kbname="'w-table-edit'"
123
+ :casename="'hideIds (hide mappingId)'"
124
+ ></demolink>
125
+
126
+ <w-table-edit
127
+ style="width:600px; height:400px;"
128
+ :name="WTableEdit.name"
129
+ :description="WTableEdit.description"
130
+ :opt="WTableEdit.opt2"
131
+ :hideIds="'mappingId'"
132
+ _hideIds="['id','mappingId','order']"
133
+ @success="evSuccess"
134
+ @error="evError"
135
+ ></w-table-edit>
136
+
137
+ </div>
138
+
139
+
140
+ <div class="bk">
141
+ <demolink
142
+ :kbname="'w-table-edit'"
143
+ :casename="'fixIds (fix id)'"
144
+ ></demolink>
145
+
146
+ <w-table-edit
147
+ style="width:600px; height:400px;"
148
+ :name="WTableEdit.name"
149
+ :description="WTableEdit.description"
150
+ :opt="WTableEdit.opt2"
151
+ :fixIds="'id'"
152
+ _fixIds="['id','mappingId']"
153
+ @success="evSuccess"
154
+ @error="evError"
155
+ ></w-table-edit>
156
+
157
+ </div>
158
+
159
+
160
+ <div class="bk">
161
+ <demolink
162
+ :kbname="'w-table-edit'"
163
+ :casename="'removeIdsWhenDownload (remove id, mappingId, order, isActive)'"
164
+ ></demolink>
165
+
166
+ <w-table-edit
167
+ style="width:600px; height:400px;"
168
+ :name="WTableEdit.name"
169
+ :description="WTableEdit.description"
170
+ :opt="WTableEdit.opt2"
171
+ :removeIdsWhenDownload="['id','mappingId','order','isActive']"
172
+ @success="evSuccess"
173
+ @error="evError"
174
+ ></w-table-edit>
175
+
176
+ </div>
177
+
178
+
179
+ <div class="bk">
180
+ <demolink
181
+ :kbname="'w-table-edit'"
182
+ :casename="'slot infor (name & description)'"
183
+ ></demolink>
184
+
185
+ <w-table-edit
186
+ style="width:600px; height:400px;"
187
+ :name="WTableEdit.name"
188
+ :description="WTableEdit.description"
189
+ :opt="WTableEdit.opt1"
190
+ @success="evSuccess"
191
+ @error="evError"
192
+ >
193
+ <template v-slot:infor="{infor}">
194
+ <div msg="外層有flex故添加一層div避免影響">
195
+ <div style="display:flex; align-items:center;">
196
+ <div style="color:#62f;">{{infor.name}}</div>
197
+ <div style="margin-left:5px; padding:0px 7px; color:#fff; font-size:0.7rem; border-radius:30px; background:#f26;">Agent</div>
198
+ <div style="margin-left:5px; padding:0px 7px; color:#fff; font-size:0.7rem; border-radius:30px; background:#fa6;">Dealer</div>
199
+ </div>
200
+ <div style="color:#888; font-size:0.7rem;">[{{infor.description}}]</div>
201
+ </div>
202
+ </template>
203
+ </w-table-edit>
204
+
205
+ </div>
206
+
207
+
208
+ <div class="bk">
209
+ <demolink
210
+ :kbname="'w-table-edit'"
211
+ :casename="'slot btns-left'"
212
+ ></demolink>
213
+
214
+ <w-table-edit
215
+ style="width:600px; height:400px;"
216
+ :name="WTableEdit.name"
217
+ :description="WTableEdit.description"
218
+ :opt="WTableEdit.opt1"
219
+ @success="evSuccess"
220
+ @error="evError"
221
+ >
222
+ <template v-slot:btns-left="props">
223
+ <select 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;">
224
+ <option style="color:#666; font-size:0.7rem;" value="0">Select Item</option>
225
+ <option style="color:#666; font-size:0.7rem;" value="1">Quisquam</option>
226
+ <option style="color:#666; font-size:0.7rem;" value="2">Dolorem</option>
227
+ <option :style="`${props.editable?'color:#666;':'color:#aaa;'} font-size:0.7rem;`" value="3" :disabled="!props.editable">Ipsum</option>
228
+ </select>
229
+ </template>
230
+ </w-table-edit>
231
+
232
+ </div>
233
+
234
+
235
+ <div class="bk">
236
+ <demolink
237
+ :kbname="'w-table-edit'"
238
+ :casename="'slot btns-right'"
239
+ ></demolink>
240
+
241
+ <w-table-edit
242
+ style="width:600px; height:400px;"
243
+ :name="WTableEdit.name"
244
+ :description="WTableEdit.description"
245
+ :opt="WTableEdit.opt1"
246
+ @success="evSuccess"
247
+ @error="evError"
248
+ >
249
+ <template v-slot:btns-right="props">
250
+ <select 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;">
251
+ <option style="color:#666; font-size:0.7rem;" value="0">Select Item</option>
252
+ <option style="color:#666; font-size:0.7rem;" value="1">Quisquam</option>
253
+ <option style="color:#666; font-size:0.7rem;" value="2">Dolorem</option>
254
+ <option :style="`${props.editable?'color:#666;':'color:#aaa;'} font-size:0.7rem;`" value="3" :disabled="!props.editable">Ipsum</option>
255
+ </select>
256
+ </template>
257
+ </w-table-edit>
258
+
259
+ </div>
260
+
261
+
262
+ <div class="bk">
263
+ <demolink
264
+ :kbname="'w-table-edit'"
265
+ :casename="'editable'"
266
+ ></demolink>
267
+
268
+ <w-table-edit
269
+ style="width:600px; height:400px;"
270
+ :name="WTableEdit.name"
271
+ :description="WTableEdit.description"
272
+ :opt="WTableEdit.opt2"
273
+ :editable="true"
274
+ @success="evSuccess"
275
+ @error="evError"
276
+ ></w-table-edit>
277
+
278
+ </div>
279
+
280
+
281
+ <div class="bk">
282
+ <demolink
283
+ :kbname="'w-table-edit'"
284
+ :casename="'editable & no enableInfor'"
285
+ ></demolink>
286
+
287
+ <w-table-edit
288
+ style="width:600px; height:400px;"
289
+ :enableInfor="false"
290
+ :name="WTableEdit.name"
291
+ :description="WTableEdit.description"
292
+ :opt="WTableEdit.opt2"
293
+ :editable="true"
294
+ @success="evSuccess"
295
+ @error="evError"
296
+ ></w-table-edit>
297
+
298
+ </div>
299
+
300
+
301
+ <div class="bk">
302
+ <demolink
303
+ :kbname="'w-table-edit'"
304
+ :casename="'editable & no enableMenu'"
305
+ ></demolink>
306
+
307
+ <w-table-edit
308
+ style="width:600px; height:400px;"
309
+ :enableMenu="false"
310
+ :name="WTableEdit.name"
311
+ :description="WTableEdit.description"
312
+ :opt="WTableEdit.opt2"
313
+ :editable="true"
314
+ @success="evSuccess"
315
+ @error="evError"
316
+ ></w-table-edit>
317
+
318
+ </div>
319
+
320
+
321
+ <div class="bk">
322
+ <demolink
323
+ :kbname="'w-table-edit'"
324
+ :casename="'editable & inforPaddingStyle & menuBackgroundColor'"
325
+ ></demolink>
326
+
327
+ <div style="background:#fafafa;">
328
+ <w-table-edit
329
+ style="width:600px; height:400px;"
330
+ :name="WTableEdit.name"
331
+ :description="WTableEdit.description"
332
+ :opt="WTableEdit.opt2"
333
+ :editable="true"
334
+ :inforPaddingStyle="{top:15,right:20,bottom:20,left:20}"
335
+ :menuBackgroundColor="'#eaeaea'"
336
+ @success="evSuccess"
337
+ @error="evError"
338
+ ></w-table-edit>
339
+ </div>
340
+
341
+ </div>
342
+
343
+
344
+ <div class="bk">
345
+ <demolink
346
+ :kbname="'w-table-edit'"
347
+ :casename="'editable & checkId'"
348
+ ></demolink>
349
+
350
+ <w-table-edit
351
+ style="width:600px; height:400px;"
352
+ :name="WTableEdit.name"
353
+ :description="WTableEdit.description"
354
+ :opt="WTableEdit.opt2"
355
+ :editable="true"
356
+ :checkId="'id'"
357
+ @success="evSuccess"
358
+ @error="evError"
359
+ ></w-table-edit>
360
+
361
+ </div>
362
+
363
+
364
+ <div class="bk">
365
+ <demolink
366
+ :kbname="'w-table-edit'"
367
+ :casename="'editable & opt.beforeAddRow'"
368
+ ></demolink>
369
+
370
+ <w-table-edit
371
+ style="width:600px; height:400px;"
372
+ :name="WTableEdit.name"
373
+ :description="WTableEdit.description"
374
+ :opt="WTableEdit.opt4"
375
+ :editable="true"
376
+ @success="evSuccess"
377
+ @error="evError"
378
+ ></w-table-edit>
379
+
380
+ </div>
381
+
382
+
383
+ <div class="bk">
384
+ <demolink
385
+ :kbname="'w-table-edit'"
386
+ :casename="'editable & opt.kpConvertKeysWhenUploadData'"
387
+ ></demolink>
388
+
389
+ <w-table-edit
390
+ style="width:600px; height:400px;"
391
+ :name="WTableEdit.name"
392
+ :description="WTableEdit.description"
393
+ :opt="WTableEdit.opt5"
394
+ :editable="true"
395
+ @success="evSuccess"
396
+ @error="evError"
397
+ ></w-table-edit>
398
+
399
+ </div>
400
+
401
+
402
+ <div class="bk">
403
+ <demolink
404
+ :kbname="'w-table-edit'"
405
+ :casename="'editable & opt.optForUploadData'"
406
+ ></demolink>
407
+
408
+ <w-table-edit
409
+ style="width:600px; height:400px;"
410
+ :name="WTableEdit.name"
411
+ :description="WTableEdit.description"
412
+ :opt="WTableEdit.opt6"
413
+ :editable="true"
414
+ @success="evSuccess"
415
+ @error="evError"
416
+ ></w-table-edit>
417
+
418
+ </div>
419
+
420
+
421
+ <div class="bk">
422
+ <demolink
423
+ :kbname="'w-table-edit'"
424
+ :casename="'editable & language & textLabelDataName & textPlaceholderDataName & textLabelDataDescription & textPlaceholderDataDescription'"
425
+ ></demolink>
426
+
427
+ <w-table-edit
428
+ style="width:600px; height:400px;"
429
+ :name="WTableEdit.name"
430
+ :description="WTableEdit.description"
431
+ :opt="WTableEdit.opt2"
432
+ :editable="true"
433
+ :language="'zh-tw'"
434
+ :textLabelDataName="'名稱'"
435
+ :textPlaceholderDataName="'請輸入數據名稱'"
436
+ :textLabelDataDescription="'說明'"
437
+ :textPlaceholderDataDescription="'請輸入數據說明'"
438
+ @success="evSuccess"
439
+ @error="evError"
440
+ ></w-table-edit>
441
+
442
+ </div>
443
+
444
+
445
+ <div class="bk">
446
+ <demolink
447
+ :kbname="'w-table-edit'"
448
+ :casename="'editable & language & checkId & tooltipAddRow & tooltipDeleteSelectedRows & tooltipDownloadExcelFile & tooltipDownloadExcelFileForDisplay & tooltipUploadExcelFile & uploadModeTitle & uploadModeTextForReplace & uploadModeTextForAppend'"
449
+ ></demolink>
450
+
451
+ <w-table-edit
452
+ style="width:600px; height:400px;"
453
+ :name="WTableEdit.name"
454
+ :description="WTableEdit.description"
455
+ :opt="WTableEdit.opt2"
456
+ :editable="true"
457
+ :language="'zh-tw'"
458
+ :checkId="'id'"
459
+ :tooltipAddRow="'新增數據'"
460
+ :tooltipDeleteSelectedRows="'刪除選擇數據'"
461
+ :tooltipDownloadExcelFile="'下載數據成為 Excel(xlsx) 檔案'"
462
+ :tooltipDownloadExcelFileForDisplay="'下載過濾後數據成為 Excel(xlsx) 檔案'"
463
+ :tooltipUploadExcelFile="'上傳 Excel(xlsx) 數據檔案'"
464
+ :uploadModeTitle="'請選擇上傳模式:'"
465
+ :uploadModeTextForReplace="'取代'"
466
+ :uploadModeTextForAppend="'於最後加入'"
467
+ @success="evSuccess"
468
+ @error="evError"
469
+ ></w-table-edit>
470
+
471
+ </div>
472
+
473
+
474
+ <div class="bk">
475
+ <demolink
476
+ :kbname="'w-table-edit'"
477
+ :casename="'editable & checkId & successMsgFromAddRow & errorMsgFromAddRow & errorMsgFromRemoveRow & errorMsgFromUploadEmptyData & errorMsgFromUploadData & successMsgFromDownloadData & errorMsgFromDownloadData'"
478
+ ></demolink>
479
+
480
+ <w-table-edit
481
+ style="width:600px; height:400px;"
482
+ :name="WTableEdit.name"
483
+ :description="WTableEdit.description"
484
+ :opt="WTableEdit.opt2"
485
+ :editable="true"
486
+ :checkId="'id'"
487
+ :successMsgFromAddRow="'新增數據成功'"
488
+ :errorMsgFromAddRow="'無法新增數據'"
489
+ :errorMsgFromRemoveRow="'移除數據失敗'"
490
+ :successMsgFromUploadData="'上傳數據成功'"
491
+ :errorMsgFromUploadData="'無法上傳數據'"
492
+ :errorMsgFromUploadEmptyData="'上傳檔案中無有效數據'"
493
+ :successMsgFromDownloadData="'下載檔案成功'"
494
+ :errorMsgFromDownloadData="'無法下載檔案'"
495
+ @success="evSuccess"
496
+ @error="evError"
497
+ ></w-table-edit>
498
+
499
+ </div>
500
+
501
+
502
+ <div class="bk">
503
+ <demolink
504
+ :kbname="'w-table-edit'"
505
+ :casename="'editable & slot btns-right'"
506
+ ></demolink>
507
+
508
+ <w-table-edit
509
+ style="width:600px; height:400px;"
510
+ :name="WTableEdit.name"
511
+ :description="WTableEdit.description"
512
+ :opt="WTableEdit.opt1"
513
+ :editable="true"
514
+ @success="evSuccess"
515
+ @error="evError"
516
+ >
517
+ <template v-slot:btns-right="props">
518
+ <select 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;">
519
+ <option style="color:#666; font-size:0.7rem;" value="0">Select Item</option>
520
+ <option style="color:#666; font-size:0.7rem;" value="1">Quisquam</option>
521
+ <option style="color:#666; font-size:0.7rem;" value="2">Dolorem</option>
522
+ <option :style="`${props.editable?'color:#666;':'color:#aaa;'} font-size:0.7rem;`" value="3" :disabled="!props.editable">Ipsum</option>
523
+ </select>
524
+ </template>
525
+ </w-table-edit>
526
+
527
+ </div>
528
+
529
+
530
+ <div class="bk">
531
+ <demolink
532
+ :kbname="'w-table-edit'"
533
+ :casename="'editable & checkId & opt.modifyDataWhenSave & save(call cmp. method) & errorMsgFromNoName & errorMsgFromNoData'"
534
+ ></demolink>
535
+
536
+ <button 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;" @click="saveData">save data</button>
537
+
538
+ <w-table-edit
539
+ ref="table"
540
+ style="width:600px; height:400px;"
541
+ :name="WTableEdit.name"
542
+ :description="WTableEdit.description"
543
+ :opt="WTableEdit.opt7"
544
+ :editable="true"
545
+ :checkId="'id'"
546
+ :errorMsgFromNoName="'未輸入數據名稱'"
547
+ :errorMsgFromNoData="'未給予有效數據'"
548
+ @success="evSuccess"
549
+ @error="evError"
550
+ ></w-table-edit>
551
+
552
+ <pre id="disp-save-data" style="font-size:0.7rem; width:600px; height:200px; overflow-y:auto;"></pre>
553
+
554
+ </div>
555
+
556
+
557
+ </div>
558
+
559
+
560
+ </div>
561
+ </template>
562
+
563
+ <script>
564
+ import demolink from './components/demolink.vue'
565
+ import WTableEdit from './components/WTableEdit.vue'
566
+
567
+
568
+ export default {
569
+ components: {
570
+ demolink,
571
+ WTableEdit,
572
+ },
573
+ props: {
574
+ },
575
+ data: function() {
576
+ let keys1 = ['make', 'model', 'price']
577
+ let kpHeadFilterType1 = { //default: num (num,text,time,set)
578
+ 'make': 'text',
579
+ 'model': 'text',
580
+ 'price': 'num',
581
+ }
582
+ let rows1 = [
583
+ { make: 'Toyota', model: 'Celica', price: 35000 },
584
+ { make: 'Ford', model: 'Mondeo', price: 32000 },
585
+ { make: 'Porsche', model: 'Boxter', price: 72000 },
586
+ { make: 'BMW', model: 'Sedan', price: 66000 },
587
+ { make: 'Nissan', model: 'March', price: 61000 },
588
+ { make: 'Lexus', model: 'RX', price: 56000 },
589
+ { make: 'Audi', model: 'A6 Allroad', price: 45000 },
590
+ { make: 'Mazda', model: 'MX-5', price: 36000 },
591
+ { make: 'Mercedes-Benz', model: 'Cabriolet', price: 86000 },
592
+ { make: 'Volkswagen', model: 'Beetle', price: 68000 },
593
+ { make: 'Honda', model: 'City', price: 69000 },
594
+ { make: 'Volvo', model: 'S60', price: 71000 },
595
+ { make: 'Subaru', model: 'BRZ', price: 48000 },
596
+ ]
597
+ let keys2 = ['id', 'mappingId', 'order', 'make', 'model', 'price', 'isActive']
598
+ let kpHeadFilterType2 = { //default: num (num,text,time,set)
599
+ 'id': 'text',
600
+ 'mappingId': 'text',
601
+ 'order': 'num',
602
+ 'make': 'text',
603
+ 'model': 'text',
604
+ 'price': 'num',
605
+ 'isActive': 'text',
606
+ }
607
+ let rows2 = [
608
+ { id: 'id-Toyota', mappingId: 'car_table', order: 0, make: 'Toyota', model: 'Celica', price: 35000, isActive: 'y' },
609
+ { id: 'id-Ford', mappingId: 'car_table', order: 1, make: 'Ford', model: 'Mondeo', price: 32000, isActive: 'y' },
610
+ { id: 'id-Porsche', mappingId: 'car_table', order: 2, make: 'Porsche', model: 'Boxter', price: 72000, isActive: 'y' },
611
+ { id: 'id-BMW', mappingId: 'car_table', order: 11, make: 'BMW', model: 'Sedan', price: 66000, isActive: 'y' },
612
+ { id: 'id-Nissan', mappingId: 'car_table', order: 8, make: 'Nissan', model: 'March', price: 61000, isActive: 'y' },
613
+ { id: 'id-Lexus', mappingId: 'car_table', order: 4, make: 'Lexus', model: 'RX', price: 56000, isActive: 'y' },
614
+ { id: 'id-Audi', mappingId: 'car_table', order: 5, make: 'Audi', model: 'A6 Allroad', price: 45000, isActive: 'y' },
615
+ { id: 'id-Mazda', mappingId: 'car_table', order: 6, make: 'Mazda', model: 'MX-5', price: 36000, isActive: 'y' },
616
+ { id: 'id-Mercedes', mappingId: 'car_table', order: 7, make: 'Mercedes-Benz', model: 'Cabriolet', price: 86000, isActive: 'y' },
617
+ { id: 'id-Volkswagen', mappingId: 'car_table', order: 9, make: 'Volkswagen', model: 'Beetle', price: 68000, isActive: 'y' },
618
+ { id: 'id-Honda', mappingId: 'car_table', order: 10, make: 'Honda', model: 'City', price: 69000, isActive: 'y' },
619
+ { id: 'id-Volvo', mappingId: 'car_table', order: 12, make: 'Volvo', model: 'S60', price: 71000, isActive: 'y' },
620
+ { id: 'id-Subaru', mappingId: 'car_table', order: 3, make: 'Subaru', model: 'BRZ', price: 48000, isActive: 'y' },
621
+ ]
622
+ let keys3 = ['id', 'mappingId', 'order', 'make', 'model', 'price', 'isActive']
623
+ let kpHeadFilterType3 = { //default: num (num,text,time,set)
624
+ 'id': 'text',
625
+ 'mappingId': 'text',
626
+ 'order': 'num',
627
+ 'make': 'text',
628
+ 'model': 'text',
629
+ 'price': 'num',
630
+ 'isActive': 'text',
631
+ }
632
+ let rows3 = [
633
+ { id: '', mappingId: '', order: 0, make: 'Toyota', model: 'Celica', price: 35000 },
634
+ { id: '', mappingId: '', order: 1, make: 'Ford', model: 'Mondeo', price: 32000 },
635
+ { id: '', mappingId: '', order: 2, make: 'Porsche', model: 'Boxter', price: 72000 },
636
+ { id: '', mappingId: '', order: 11, make: 'BMW', model: 'Sedan', price: 66000 },
637
+ { id: '', mappingId: '', order: 8, make: 'Nissan', model: 'March', price: 61000 },
638
+ { id: '', mappingId: '', order: 4, make: 'Lexus', model: 'RX', price: 56000 },
639
+ { id: '', mappingId: '', order: 5, make: 'Audi', model: 'A6 Allroad', price: 45000 },
640
+ { id: '', mappingId: '', order: 6, make: 'Mazda', model: 'MX-5', price: 36000 },
641
+ { id: '', mappingId: '', order: 7, make: 'Mercedes-Benz', model: 'Cabriolet', price: 86000 },
642
+ { id: '', mappingId: '', order: 9, make: 'Volkswagen', model: 'Beetle', price: 68000 },
643
+ { id: '', mappingId: '', order: 10, make: 'Honda', model: 'City', price: 69000 },
644
+ { id: '', mappingId: '', order: 12, make: 'Volvo', model: 'S60', price: 71000 },
645
+ { id: '', mappingId: '', order: 3, make: 'Subaru', model: 'BRZ', price: 48000 },
646
+ ]
647
+ return {
648
+ 'WTableEdit': {
649
+ 'name': 'Car Price',
650
+ 'description': 'The relationship between different car types and prices',
651
+ 'opt1': {
652
+ keys: keys1,
653
+ kpHeadFilterType: kpHeadFilterType1,
654
+ rows: rows1,
655
+ },
656
+ 'opt2': {
657
+ keys: keys2,
658
+ kpHeadFilterType: kpHeadFilterType2,
659
+ rows: rows2,
660
+ },
661
+ 'opt3': {
662
+ keys: keys2,
663
+ kpHeadFilterType: kpHeadFilterType2,
664
+ rows: rows2,
665
+ kpHead: {
666
+ id: '主鍵',
667
+ mappingId: '所屬主鍵',
668
+ order: '順序',
669
+ make: 'Ecirp',
670
+ model: 'Ledom',
671
+ price: 'Ecirp',
672
+ isActive: '有效',
673
+ },
674
+ },
675
+ 'opt4': {
676
+ keys: keys2,
677
+ kpHeadFilterType: kpHeadFilterType2,
678
+ rows: rows2,
679
+ beforeAddRow: function(newRow) {
680
+ newRow.id = 'id-random-' + Math.random()
681
+ return newRow
682
+ },
683
+ },
684
+ 'opt5': {
685
+ keys: keys2,
686
+ kpHeadFilterType: kpHeadFilterType2,
687
+ rows: rows2,
688
+ kpConvertKeysWhenUploadData: {
689
+ makeTemp: 'make',
690
+ modelTemp: 'model',
691
+ priceTemp: 'price',
692
+ },
693
+ },
694
+ 'opt6': {
695
+ keys: keys2,
696
+ rows: rows2,
697
+ optForUploadData: { //input for uploadData in w-aggrid-vue, https://github.com/yuda-lyu/w-aggrid-vue
698
+ beforeUpload: null,
699
+ parseSheetInd: 1, //取第2個sheet, 預設0(取第1個sheet)
700
+ },
701
+ },
702
+ 'opt7': {
703
+ keys: keys3,
704
+ kpHeadFilterType: kpHeadFilterType3,
705
+ rows: rows3,
706
+ modifyDataWhenSave: function(rows) {
707
+ console.log('modifyDataWhenSave', rows)
708
+ for (let k = 0; k < rows.length; k++) {
709
+ let v = rows[k]
710
+ v.id = 'id-random-' + Math.random()
711
+ v.mappingId = 'auto_car_table'
712
+ v.order = k
713
+ v.isActive = 'y'
714
+ }
715
+ return rows
716
+ },
717
+ },
718
+ },
719
+ 'actions': [
720
+ ],
721
+ }
722
+ },
723
+ methods: {
724
+ evSuccess: function(msg) {
725
+ console.log('evSuccess:', msg)
726
+ },
727
+ evError: function(msg) {
728
+ console.log('evError:', msg)
729
+ },
730
+ saveData: function() {
731
+ let data = this.$refs.table.save()
732
+ document.querySelector('#disp-save-data').innerHTML = JSON.stringify(data, null, 2)
733
+ console.log('saveData:', data)
734
+ },
735
+ },
736
+ }
737
+ </script>
738
+
739
+ <style scoped>
740
+ </style>