@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-b-alpha

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 (152) hide show
  1. package/dist/buildinschemas/branch.d.ts.map +1 -1
  2. package/dist/buildinschemas/branch.js +1 -0
  3. package/dist/buildinschemas/branch.js.map +1 -1
  4. package/dist/buildinschemas/changehistories.d.ts +3 -0
  5. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  6. package/dist/buildinschemas/changehistories.js +36 -0
  7. package/dist/buildinschemas/changehistories.js.map +1 -0
  8. package/dist/buildinschemas/index.d.ts +1 -0
  9. package/dist/buildinschemas/index.d.ts.map +1 -1
  10. package/dist/buildinschemas/index.js +3 -1
  11. package/dist/buildinschemas/index.js.map +1 -1
  12. package/dist/buildinschemas/organization.js +2 -2
  13. package/dist/buildinschemas/organization.js.map +1 -1
  14. package/dist/buildinschemas/user.d.ts.map +1 -1
  15. package/dist/buildinschemas/user.js +5 -1
  16. package/dist/buildinschemas/user.js.map +1 -1
  17. package/dist/buildinschemas/webhook.d.ts +3 -0
  18. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  19. package/dist/buildinschemas/webhook.js +33 -0
  20. package/dist/buildinschemas/webhook.js.map +1 -0
  21. package/dist/framework.d.ts.map +1 -1
  22. package/dist/framework.js +3 -2
  23. package/dist/framework.js.map +1 -1
  24. package/dist/generate.js +30 -11
  25. package/dist/generate.js.map +1 -1
  26. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  27. package/dist/processors/jsonschemabuilder.js +10 -2
  28. package/dist/processors/jsonschemabuilder.js.map +1 -1
  29. package/dist/type.d.ts +2 -0
  30. package/dist/type.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/buildinschemas/branch.ts +1 -0
  33. package/src/buildinschemas/changehistories.ts +33 -0
  34. package/src/buildinschemas/index.ts +2 -1
  35. package/src/buildinschemas/organization.ts +2 -2
  36. package/src/buildinschemas/user.ts +5 -1
  37. package/src/buildinschemas/webhook.ts +31 -0
  38. package/src/framework.ts +3 -2
  39. package/src/generate.ts +35 -15
  40. package/src/processors/jsonschemabuilder.ts +10 -2
  41. package/src/type.ts +2 -0
  42. package/templates/basic/nest/controller.ts.eta +24 -3
  43. package/templates/basic/nest/model.ts.eta +9 -1
  44. package/templates/basic/nest/resolver.ts.eta +2 -2
  45. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  46. package/templates/basic/nuxt/pages.form.vue.eta +1 -4
  47. package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
  48. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  49. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  50. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  51. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +21 -8
  52. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  53. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  54. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  55. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -8
  56. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  57. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  58. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +7 -12
  59. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +133 -28
  60. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  61. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  62. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  63. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +33 -8
  64. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +15 -9
  65. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  66. package/templates/nuxt/assets/css/style.css._eta +1 -1
  67. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  68. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  69. package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
  70. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  71. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  72. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  73. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  74. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  75. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  76. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
  77. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +76 -52
  78. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  79. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  80. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +35 -13
  81. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  82. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  83. package/templates/nuxt/components/form/FormUser.vue._eta +2 -4
  84. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  85. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  86. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  87. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +34 -14
  88. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  89. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
  90. package/templates/nuxt/components/list/ListView.vue.eta +64 -35
  91. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
  92. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
  93. package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
  94. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  95. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  96. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  97. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +14 -8
  98. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  99. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  100. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  101. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  102. package/templates/nuxt/components/select/SelectTemplate.vue.eta +53 -22
  103. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  104. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +25 -16
  105. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +60 -0
  106. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
  107. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  108. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  109. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +114 -38
  110. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  111. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +44 -40
  112. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  113. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  114. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  115. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +138 -95
  116. package/templates/nuxt/components/user/UserInvitation.vue.eta +53 -45
  117. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +32 -71
  118. package/templates/nuxt/composables/date.generate.ts.eta +105 -8
  119. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  120. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  121. package/templates/nuxt/composables/getUserStore.generate.ts.eta +39 -6
  122. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  123. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  124. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  125. package/templates/nuxt/composables/roles.generate.ts.eta +9 -13
  126. package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
  127. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  128. package/templates/nuxt/error.vue._eta +4 -2
  129. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
  130. package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
  131. package/templates/nuxt/pages/login.vue._eta +4 -1
  132. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +54 -26
  133. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  134. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  135. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  136. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  137. package/templates/nuxt/types/events.ts.eta +3 -2
  138. package/templates/nuxt/types/others.ts.eta +11 -1
  139. package/templates/nuxt/types/schema.ts.eta +3 -1
  140. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  141. package/templates/nuxt/types/user.ts.eta +8 -7
  142. package/templates/project/jsonschemas/branch.json._eta +1 -0
  143. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  144. package/templates/project/jsonschemas/organization.json._eta +2 -2
  145. package/templates/project/lang/default._json +6 -2
  146. package/tsconfig.tsbuildinfo +1 -1
  147. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  148. /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
  149. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  150. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  151. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
  152. /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
@@ -34,71 +34,51 @@
34
34
  v-bind="componentProps as InputSwitchProps"
35
35
  @change="onChange"
36
36
  />
37
- <!--
38
- <InputText
39
- type="date"
40
- :pt="pt"
41
- v-else-if="inputType == SimpleAppInputType.date"
42
- :inputId="slotprops.uuid"
43
- :path="setting.instancepath"
44
- v-model="datevalue"
45
- @update:modelValue="updateDate"
46
- :readonly="isReadonly"
47
- :placeholder="placeholder"
48
- v-bind="componentProps as InputTextProps"
49
- /> -->
37
+
50
38
  <!-- calendar component -->
51
- <Calendar
52
- type="date"
53
- :pt="pt"
39
+ <SimpleAppCalendarInput
54
40
  v-else-if="
55
41
  SimpleAppInputType.calendar == inputType ||
56
42
  inputType == SimpleAppInputType.date
57
43
  "
58
- :inputId="slotprops.uuid"
59
- :path="setting.instancepath"
60
- v-model="datevalue"
61
- @update:modelValue="updateDate"
62
- :touchUI="isMobile()"
63
- showButtonBar
64
- :readonly="isReadonly"
44
+ :pt="pt"
45
+ type="date"
46
+ v-model="modelValue"
47
+ :uuid="slotprops.uuid"
65
48
  :placeholder="placeholder"
66
- :date-format="getDateFormat()"
67
- v-bind="componentProps as CalendarProps"
68
- />
69
-
49
+ :setting="setting"
50
+ :readonly="isReadonly"
51
+ :componentProps="componentProps"
52
+ @change="onChange"
53
+ />
54
+
70
55
  <!-- time component -->
71
- <Calendar
72
- :pt="pt"
56
+ <SimpleAppCalendarInput
73
57
  v-else-if="inputType == SimpleAppInputType.time"
74
- timeOnly
75
- showTime
76
- hourFormat="12"
77
- @update:modelValue="updateTime"
78
- :inputId="slotprops.uuid"
79
- :path="setting.instancepath"
80
- v-model="timevalue"
81
- :readonly="isReadonly"
82
- :placeholder="placeholder"
83
- v-bind="componentProps as CalendarProps"
84
- />
85
-
86
- <Calendar
87
58
  :pt="pt"
88
- v-else-if="inputType == SimpleAppInputType.datetime"
89
- :inputId="slotprops.uuid"
90
- :path="setting.instancepath"
91
- v-model="datetimevalue"
92
- @update:modelValue="updateDateTime"
93
- :touchUI="isMobile()"
94
- showButtonBar
59
+ type="time"
60
+ v-model="modelValue"
61
+ :uuid="slotprops.uuid"
62
+ :placeholder="placeholder"
63
+ :setting="setting"
95
64
  :readonly="isReadonly"
65
+ :componentProps="componentProps"
66
+ @change="onChange"
67
+ />
68
+
69
+ <SimpleAppCalendarInput
70
+ v-else-if="inputType == SimpleAppInputType.datetime"
71
+ :pt="pt"
72
+ type="datetime"
73
+ v-model="modelValue"
74
+ :uuid="slotprops.uuid"
96
75
  :placeholder="placeholder"
97
- :date-format="getDateFormat()"
98
- showTime
99
- hourFormat="12"
100
- v-bind="componentProps as CalendarProps"
101
- />
76
+ :setting="setting"
77
+ :readonly="isReadonly"
78
+ :componentProps="componentProps"
79
+ @change="onChange"
80
+ />
81
+
102
82
  <!-- select/list component -->
103
83
  <Listbox
104
84
  v-model="modelValue"
@@ -134,7 +114,6 @@
134
114
  @change="onChange"
135
115
  />
136
116
 
137
-
138
117
  <MultiSelect
139
118
  v-model="modelValue"
140
119
  :pt="pt"
@@ -168,6 +147,31 @@
168
147
  </div>
169
148
  </div>
170
149
 
150
+ <SimpleAppUserPicker
151
+ v-else-if="inputType == SimpleAppInputType.user"
152
+ v-model="modelValue as autocompletetype"
153
+ :hidelabel="hidelabel"
154
+ :pt="pt"
155
+ :setting="setting"
156
+ :disabled="isReadonly"
157
+ :inputId="slotprops.uuid"
158
+ :path="setting.instancepath"
159
+ :readonly="isReadonly"
160
+ :placeholder="placeholder"
161
+ :autocompleteFilter="autocompleteFilter"
162
+ @change="onChange"
163
+ >
164
+ <template #header>
165
+ <slot name="header"></slot>
166
+ </template>
167
+ <template #content>
168
+ <slot name="content"></slot>
169
+ </template>
170
+ <template #option="{ index, option }">
171
+ <slot name="option" :index="index" :option="option"></slot>
172
+ </template>
173
+ </SimpleAppUserPicker>
174
+
171
175
  <!-- autocomplete, need do more enterprise grade component-->
172
176
  <SimpleAppAutocomplete
173
177
  v-else-if="inputType == SimpleAppInputType.autocomplete"
@@ -182,7 +186,17 @@
182
186
  :placeholder="placeholder"
183
187
  :autocompleteFilter="autocompleteFilter"
184
188
  @change="onChange"
185
- />
189
+ >
190
+ <template #header>
191
+ <slot name="header"></slot>
192
+ </template>
193
+ <template #content>
194
+ <slot name="content"></slot>
195
+ </template>
196
+ <template #option="{ index, option }">
197
+ <slot name="option" :index="index" :option="option"></slot>
198
+ </template>
199
+ </SimpleAppAutocomplete>
186
200
  <!-- v-bind:attributes="componentProps" -->
187
201
  <!-- document no input-->
188
202
  <SimpleAppDocumentNo
@@ -265,6 +279,8 @@
265
279
  @focus="setFocus"
266
280
  :max-fraction-digits="2"
267
281
  :min-fraction-digits="2"
282
+ mode="currency"
283
+ :currency="getCurrency()"
268
284
  :readonly="isReadonly"
269
285
  :pt="pt"
270
286
  :class="!pt ? 'w-full flex flex-col' : ''"
@@ -340,10 +356,8 @@ const resetcount = ref(0);
340
356
  const instancepath = ref("");
341
357
  const modelValue = defineModel({ required: true });
342
358
 
343
- const datevalue = ref<Date>();
344
- const datetimevalue = ref<Date>();
345
- const timevalue = ref<Date>();
346
- let watchOnChange = 0;
359
+
360
+ const watchOnChange = ref(false);
347
361
  const props = withDefaults(
348
362
  defineProps<{
349
363
  inputType: SimpleAppInputType;
@@ -353,6 +367,7 @@ const props = withDefaults(
353
367
  setting: any;
354
368
  type?: string;
355
369
  instancepath?: string;
370
+ options?: string[];
356
371
  hidelabel?: boolean;
357
372
  readonly?: boolean;
358
373
  autofocus?: boolean;
@@ -373,26 +388,6 @@ const props = withDefaults(
373
388
 
374
389
  const pt = ref(props.pt);
375
390
 
376
- if (props.inputType == SimpleAppInputType.date && modelValue.value) {
377
- datevalue.value = stringToDate(<string>modelValue.value); //.format("YYYY-MM-DD");
378
- } else {
379
- datevalue.value = undefined;
380
- }
381
- if (props.inputType == SimpleAppInputType.datetime && modelValue.value) {
382
- datetimevalue.value = stringToDate(<string>modelValue.value);
383
- } else {
384
- datetimevalue.value = undefined;
385
- }
386
-
387
- if (props.inputType == SimpleAppInputType.time) {
388
- if (modelValue.value) {
389
- timevalue.value = stringToDate(
390
- (today() + "T" + modelValue.value) as string,
391
- ); //.format("YYYY-MM-DD");
392
- } else {
393
- timevalue.value = undefined;
394
- }
395
- }
396
391
 
397
392
  if (props?.instancepath) instancepath.value = props.instancepath;
398
393
  else if (props.setting?.instancepath)
@@ -424,6 +419,8 @@ watch(props.setting.errors, (newvalue, oldvalue) => {
424
419
  } else {
425
420
  pt.value = props.pt;
426
421
  }
422
+
423
+ watchOnChange.value = true;
427
424
  });
428
425
  const isReadonly = computed(() => {
429
426
  if (props.readonly) {
@@ -434,39 +431,19 @@ const isReadonly = computed(() => {
434
431
  return false;
435
432
  }
436
433
  });
437
- const updateTime = (value: Date) => {
438
- value.setSeconds(0);
439
- modelValue.value = dateToTimeString(value);
440
- onChange();
441
- };
442
- const updateDate = (value: any) => {
443
- if (value) {
444
- modelValue.value = dateToString(value);
445
- } else {
446
- modelValue.value = "";
447
- }
448
- onChange();
449
- };
450
- const updateDateTime = (value: any) => {
451
- if (value) {
452
- modelValue.value = dateToISOString(value);
453
- } else {
454
- modelValue.value = "";
455
- }
456
- onChange();
457
- };
434
+
458
435
 
459
436
  const setFocus = (ev: any) => {
460
437
  if (!isMobile()) ev.target.select();
461
438
  };
462
439
 
463
440
  const getListOptions = () => {
464
- const options = [];
465
- const enumlist = props.setting.fieldsetting.type == 'array'
466
- ? props.setting.fieldsetting.items.enum
467
- : props.setting.fieldsetting.enum
468
-
469
-
441
+ const options = [];
442
+ const enumlist =
443
+ props.options ??
444
+ (props.setting.fieldsetting.type == "array"
445
+ ? props.setting.fieldsetting.items.enum
446
+ : props.setting.fieldsetting.enum);
470
447
 
471
448
  if (enumlist) {
472
449
  for (let i = 0; i < enumlist.length; i++) {
@@ -487,69 +464,13 @@ const emits = defineEmits([
487
464
  "update:docNoFormat",
488
465
  ]);
489
466
 
490
- const getDateFormat = () => {
491
- return getPrimevueCalendarDateFormat();
492
- };
493
-
494
- watch(modelValue, (newvalue: any) => {
495
- if (
496
- [SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
497
- props.inputType,
498
- )
499
- ) {
500
- if (modelValue.value) {
501
- datevalue.value = stringToDate(modelValue.value as string);
502
- } else {
503
- timevalue.value = undefined;
504
- }
505
- } else if (props.inputType == SimpleAppInputType.datetime) {
506
- if (modelValue.value) {
507
- datetimevalue.value = stringToDate(modelValue.value as string);
508
- } else {
509
- timevalue.value = undefined;
510
- }
511
- } else if (props.inputType == SimpleAppInputType.time) {
512
- if (modelValue.value) {
513
- timevalue.value = stringToDate(
514
- (today() + "T" + modelValue.value) as string,
515
- );
516
- } else {
517
- timevalue.value = undefined;
518
- }
519
- }
520
- });
521
- onMounted(() => {
522
- if (
523
- [SimpleAppInputType.date, SimpleAppInputType.calendar].includes(
524
- props.inputType,
525
- )
526
- ) {
527
- if (modelValue.value) {
528
- datevalue.value = stringToDate(modelValue.value as string);
529
- } else {
530
- datevalue.value = undefined;
531
- }
532
- } else if (props.inputType == SimpleAppInputType.datetime) {
533
- if (modelValue.value) {
534
- datetimevalue.value = stringToDate(modelValue.value as string);
535
- } else {
536
- datetimevalue.value = undefined;
537
- }
538
- } else if (props.inputType == SimpleAppInputType.time) {
539
- if (modelValue.value) {
540
- timevalue.value = stringToDate(
541
- (today() + "T" + modelValue.value) as string,
542
- );
543
- } else {
544
- timevalue.value = undefined;
545
- }
546
- }
547
- });
548
467
 
549
468
  const onChange = () => {
550
- pt.value = undefined;
551
- resetcount.value++;
552
- emits("change", modelValue.value);
469
+ if (props.setting.document.isReady()) {
470
+ pt.value = undefined;
471
+ resetcount.value++;
472
+ emits("change", modelValue.value);
473
+ }
553
474
  };
554
475
 
555
476
  /************ start autocomplete only ***************/
@@ -1,29 +1,36 @@
1
1
  <template>
2
- <DataTable v-bind="$attrs" stripedRows resizableColumns
3
- class="simpleapp-datatable p-datatable-sm" :value="modelValue">
4
- <template #empty> <div class="text-center">No record found.</div> </template>
5
- <template #header v-if="!setting.readonly && !readonly">
6
- <div >
7
- <Button icon="pi pi-plus" @click="addNew()" class="simpleapp-datatable-add btn-primary" type="button">Add</Button>
8
- </div>
2
+ <DataTable
3
+ v-bind="$attrs"
4
+ stripedRows
5
+ resizableColumns
6
+ :rowClass="()=>'align-top'"
7
+ class="simpleapp-datatable p-datatable-sm"
8
+ :value="modelValue"
9
+ >
10
+ <template #empty>
11
+ <div class="text-center">No record found.</div>
12
+ </template>
13
+ <template #header v-if="!setting.readonly && !readonly">
14
+ <div class="flex flex-row gap-2">
15
+ <slot name="header">
16
+ <Button
17
+ icon="pi pi-plus"
18
+ @click="addNew()"
19
+ class="simpleapp-datatable-add btn-primary"
20
+ type="button"
21
+ >{{ t("add") }}</Button
22
+ >
23
+ </slot>
24
+ </div>
9
25
  </template>
10
26
  <slot>
11
-
12
-
13
- <Column class="text-center" header="undefine columns">
14
- <template #body>
15
- <div class="text-center">Missing {{ '<Column></Column>' }}</div>
16
- </template>
17
-
18
- </Column>
19
-
20
-
21
-
22
-
27
+ <Column class="text-center" header="undefine columns">
28
+ <template #body>
29
+ <div class="text-center">Missing {{ '<Column></Column>' }}</div>
30
+ </template>
31
+ </Column>
23
32
  </slot>
24
-
25
-
26
- </DataTable>
33
+ </DataTable>
27
34
  </template>
28
35
  <script setup lang="ts">
29
36
  /**
@@ -32,31 +39,28 @@
32
39
  * last change 2023-10-28
33
40
  * Author: Ks Tan
34
41
  */
35
- import {ref} from 'vue'
36
- import DataTable from 'primevue/datatable';
37
- import Column from 'primevue/column';
42
+ import { ref } from "vue";
43
+ import DataTable from "primevue/datatable";
44
+ import Column from "primevue/column";
38
45
 
39
46
  const props = defineProps<{
40
- // columns:InputTableColumn[],
41
- setting:any,
42
- getField:Function,
43
- readonly?:boolean
44
- }>()
45
-
47
+ // columns:InputTableColumn[],
48
+ setting: any;
49
+ getField: Function;
50
+ readonly?: boolean;
51
+ }>();
46
52
 
47
53
  //{path: '#/properties/details', instancepath: '/details', fieldsetting: {…}, modelObject: Proxy(Object), apiObj: INVApi, …}
48
- const modelValue = defineModel<any[]>()
49
-
50
-
54
+ const modelValue = defineModel<any[]>();
55
+
51
56
  const addNew = () => {
52
- const field = props.setting.path.split('/').at(-1)
53
- props.setting.document[`add${field}`]()
54
- }
55
- /**
57
+ const field = props.setting.path.split("/").at(-1);
58
+ props.setting.document[`add${field}`]();
59
+ };
60
+ /**
56
61
  * 1. support array with field to label
57
62
  * 2. auto add edit button
58
63
  * 3. option readonly or not readonly
59
- * 4.
64
+ * 4.
60
65
  */
61
-
62
66
  </script>