@simitgroup/simpleapp-generator 1.3.3-alpha → 1.3.4-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.
- package/dist/framework.js +2 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +7 -11
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +8 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/framework.ts +2 -2
- package/src/generate.ts +15 -12
- package/src/processors/jsonschemabuilder.ts +12 -1
- package/templates/basic/nest/controller.ts.eta +16 -5
- package/templates/basic/nuxt/component.select.vue.eta +35 -0
- package/templates/basic/nuxt/pages.form.vue.eta +5 -8
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +3 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +10 -9
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +2 -2
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +38 -38
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +14 -9
- package/templates/nuxt/assets/css/style.css._eta +39 -3
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +17 -12
- package/templates/nuxt/components/button/ButtonAction.vue._eta +19 -0
- package/templates/nuxt/components/button/ButtonDanger.vue._eta +13 -6
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +13 -6
- package/templates/nuxt/components/button/ButtonMultiple.vue._eta +9 -7
- package/templates/nuxt/components/button/ButtonPrimary.vue._eta +13 -6
- package/templates/nuxt/components/button/ButtonText.vue._eta +16 -7
- package/templates/nuxt/components/button/ButtonWarning.vue._eta +13 -6
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +83 -69
- package/templates/nuxt/components/chart/card.vue._eta +32 -0
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +44 -21
- package/templates/nuxt/components/event/EventNotification.vue._eta +119 -107
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +129 -75
- package/templates/nuxt/components/list/ListView.vue.eta +44 -13
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +6 -5
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +35 -37
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +3 -4
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +3 -2
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +38 -34
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +79 -0
- package/templates/nuxt/components/select/readme.md +1 -0
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +181 -35
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +70 -0
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +77 -73
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +113 -111
- package/templates/nuxt/components/simpleApp/{SimpleAppFormToolBar.vue.eta → SimpleAppFormToolBar.vue._eta} +125 -61
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +116 -42
- package/templates/nuxt/components/text/TextPrimary.vue._eta +13 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +68 -0
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +81 -70
- package/templates/nuxt/composables/date.generate.ts.eta +2 -0
- package/templates/nuxt/composables/getDocument.generate.ts.eta +35 -2
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +5 -1
- package/templates/nuxt/composables/refreshDocumentList.generate.ts.eta +2 -1
- package/templates/nuxt/lang/en.ts.eta +3 -1
- package/templates/nuxt/nuxt.config.ts._eta +3 -0
- package/templates/nuxt/pages/index.vue._eta +10 -56
- package/templates/nuxt/pages/picktenant.vue._eta +19 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +10 -2
- package/templates/nuxt/server/api/[xorg]/[...].ts.eta +9 -10
- package/templates/nuxt/types/calendar.ts.eta +2 -0
- package/templates/nuxt/types/events.ts.eta +3 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -0
- package/templates/project/lang/default._json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue.eta +0 -103
|
@@ -144,7 +144,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
144
144
|
}
|
|
145
145
|
// console.log(this.moreAutoCompleteField);
|
|
146
146
|
};
|
|
147
|
-
async getAutoComplete(appuser: UserContext, keyword: string) {
|
|
147
|
+
async getAutoComplete(appuser: UserContext, keyword: string, data?: T) {
|
|
148
148
|
try {
|
|
149
149
|
const filter1 = {};
|
|
150
150
|
const filter2 = {};
|
|
@@ -156,11 +156,11 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
156
156
|
filter1[this.documentIdentityCode] = { $regex: keyword, $options: 'i' };
|
|
157
157
|
filters.push(filter1);
|
|
158
158
|
}
|
|
159
|
-
|
|
160
159
|
filter2[this.documentIdentityLabel] = { $regex: keyword, $options: 'i' };
|
|
161
160
|
filters.push(filter2);
|
|
162
|
-
const filterobj = { $or: filters };
|
|
163
161
|
|
|
162
|
+
const filterobj = { $or: filters };
|
|
163
|
+
Object.assign(filterobj, data);
|
|
164
164
|
Object.assign(filterobj, this.getIsolationFilter(appuser));
|
|
165
165
|
let projections = {
|
|
166
166
|
label: `\$${this.documentIdentityLabel}`,
|
|
@@ -279,7 +279,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
279
279
|
data._id = crypto.randomUUID();
|
|
280
280
|
}
|
|
281
281
|
const dbsession = appuser.getDBSession();
|
|
282
|
-
if (!dbsession.inTransaction()) {
|
|
282
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
283
283
|
dbsession.startTransaction();
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -307,6 +307,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
307
307
|
await this.validateData(appuser, data);
|
|
308
308
|
this.logger.debug(data, `after create validation`);
|
|
309
309
|
this.applyNestedDateTime(appuser, data, 'create');
|
|
310
|
+
|
|
310
311
|
this.logger.debug(data, `Create Record ${this.documentName}`);
|
|
311
312
|
const newdoc = new this.doc(data);
|
|
312
313
|
await this.identifyForeignKeys(appuser, data);
|
|
@@ -322,10 +323,15 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
322
323
|
// this.doc
|
|
323
324
|
|
|
324
325
|
// result = await newdoc.save()
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
try {
|
|
327
|
+
if (this.hooks.afterCreate) await this.hooks.afterCreate(appuser, result);
|
|
328
|
+
return result as T;
|
|
329
|
+
} catch (err) {
|
|
330
|
+
throw new InternalServerErrorException(
|
|
331
|
+
`createHook ${this.documentType} error: ${err}`,
|
|
332
|
+
`${this.documentType} createHook error`,
|
|
333
|
+
);
|
|
334
|
+
}
|
|
329
335
|
}
|
|
330
336
|
|
|
331
337
|
applyNestedDateTime = (
|
|
@@ -444,13 +450,14 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
444
450
|
throw new NotFoundException(`${id} not found`, 'not found');
|
|
445
451
|
}
|
|
446
452
|
const dbsession = appuser.getDBSession();
|
|
447
|
-
if (!dbsession.inTransaction()) {
|
|
453
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
448
454
|
dbsession.startTransaction();
|
|
449
455
|
}
|
|
450
456
|
|
|
451
457
|
let dependency;
|
|
452
458
|
try {
|
|
453
|
-
if (this.hooks.beforeDelete)
|
|
459
|
+
if (this.hooks.beforeDelete)
|
|
460
|
+
await this.hooks.beforeDelete(appuser, id, deletedata);
|
|
454
461
|
this.logger.debug('delete record', this.documentName, id);
|
|
455
462
|
dependency = await this.getRelatedRecords(appuser, id);
|
|
456
463
|
//console.log('dependency', dependency);
|
|
@@ -480,7 +487,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
480
487
|
//this.doc.findByIdAndDelete(id);
|
|
481
488
|
return deleteresult;
|
|
482
489
|
} else {
|
|
483
|
-
|
|
490
|
+
this.logger.debug('reject query', dependency);
|
|
484
491
|
|
|
485
492
|
throw new ForbiddenException(dependency, 'Foreignkey constraint');
|
|
486
493
|
}
|
|
@@ -494,56 +501,46 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
494
501
|
// this.doc.updateOne(data);
|
|
495
502
|
// };
|
|
496
503
|
|
|
497
|
-
findIdThenUpdate = async (
|
|
498
|
-
appuser: UserContext,
|
|
499
|
-
id: string,
|
|
500
|
-
data: T,
|
|
501
|
-
session: mongo.ClientSession = undefined,
|
|
502
|
-
) => {
|
|
504
|
+
findIdThenUpdate = async (appuser: UserContext, id: string, data: T) => {
|
|
503
505
|
const existingdata = await this.findById(appuser, id);
|
|
504
506
|
if (!existingdata) {
|
|
505
507
|
throw new NotFoundException(`${id} not found`, 'not found');
|
|
506
508
|
}
|
|
507
509
|
|
|
508
510
|
if (this.hooks.beforeUpdate)
|
|
509
|
-
await this.hooks.beforeUpdate(appuser, id, data);
|
|
511
|
+
await this.hooks.beforeUpdate(appuser, id, data, existingdata);
|
|
510
512
|
|
|
511
513
|
const dbsession = appuser.getDBSession();
|
|
512
|
-
if (!dbsession.inTransaction()) {
|
|
514
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
513
515
|
dbsession.startTransaction();
|
|
514
516
|
}
|
|
515
517
|
// try {
|
|
516
518
|
Object.assign(data, appuser.getUpdateFilter());
|
|
517
519
|
// Object.assign(existingdata, data);
|
|
518
520
|
delete data['_id'];
|
|
519
|
-
|
|
520
521
|
this.reCalculateValue(data);
|
|
521
522
|
|
|
522
523
|
// existingdata['_id']=''
|
|
523
|
-
// console.log("newdata",data)
|
|
524
524
|
await this.validateData(appuser, data);
|
|
525
525
|
|
|
526
526
|
const isolationFilter = { ...this.getIsolationFilter(appuser) };
|
|
527
527
|
this.polishIsolationFilter(isolationFilter);
|
|
528
|
-
|
|
529
528
|
isolationFilter['_id'] = id;
|
|
530
529
|
this.applyNestedDateTime(appuser, data, 'update');
|
|
531
|
-
|
|
532
530
|
try {
|
|
533
531
|
const result = await this.doc.findOneAndReplace(isolationFilter, data, {
|
|
534
532
|
session: dbsession,
|
|
535
533
|
});
|
|
536
|
-
|
|
537
534
|
appuser.addUpdatedRecordId(this.documentName, data._id);
|
|
538
|
-
|
|
539
535
|
if (this.hooks.afterUpdate)
|
|
540
536
|
await this.hooks.afterUpdate(appuser, id, result);
|
|
541
537
|
return await this.findById(appuser, id);
|
|
542
538
|
} catch (err) {
|
|
539
|
+
this.logger.error(err);
|
|
543
540
|
throw new InternalServerErrorException(err.message);
|
|
544
541
|
}
|
|
545
542
|
};
|
|
546
|
-
|
|
543
|
+
|
|
547
544
|
findIdThenPatch = async (
|
|
548
545
|
appuser: UserContext,
|
|
549
546
|
id: string,
|
|
@@ -556,10 +553,10 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
556
553
|
}
|
|
557
554
|
|
|
558
555
|
if (this.hooks.beforeUpdate)
|
|
559
|
-
await this.hooks.beforeUpdate(appuser, id, data);
|
|
556
|
+
await this.hooks.beforeUpdate(appuser, id, data,existingdata);
|
|
560
557
|
|
|
561
558
|
const dbsession = appuser.getDBSession();
|
|
562
|
-
if (!dbsession.inTransaction()) {
|
|
559
|
+
if (dbsession && !dbsession.inTransaction()) {
|
|
563
560
|
dbsession.startTransaction();
|
|
564
561
|
}
|
|
565
562
|
// try {
|
|
@@ -598,7 +595,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
598
595
|
//find what foreign key constraint
|
|
599
596
|
async getRelatedRecords(appuser: UserContext, id: string) {
|
|
600
597
|
this.logger.debug('get foreignkey for delete:', id);
|
|
601
|
-
console.log('session modifeds', appuser.getModifieds());
|
|
598
|
+
// console.log('session modifeds', appuser.getModifieds());
|
|
602
599
|
if (foreignkeys === undefined) {
|
|
603
600
|
this.logger.error('foreignkeys object undetected');
|
|
604
601
|
throw new InternalServerErrorException('foreignkeys object undetected');
|
|
@@ -670,21 +667,24 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
670
667
|
'set documentstatus id not match with submited data',
|
|
671
668
|
);
|
|
672
669
|
}
|
|
673
|
-
|
|
670
|
+
const existdata = await this.findById(appuser, id);
|
|
671
|
+
if (existdata && existdata['documentStatus'] == docstatus) {
|
|
672
|
+
throw new BadRequestException(
|
|
673
|
+
`Same document status "${docstatus}" is not allowed`,
|
|
674
|
+
);
|
|
675
|
+
}
|
|
674
676
|
data['documentStatus'] = docstatus;
|
|
675
677
|
// await this.hook(appuser, HookType.beforeSetStatus, data);
|
|
676
678
|
if (this.hooks.beforeSetStatus)
|
|
677
|
-
await this.hooks.beforeSetStatus(appuser, docstatus, data);
|
|
679
|
+
await this.hooks.beforeSetStatus(appuser, docstatus, data, existdata);
|
|
680
|
+
|
|
678
681
|
if (data && !data['created']) {
|
|
679
682
|
const createresult = await this.create(appuser, data);
|
|
680
683
|
if (this.hooks.afterSetStatus)
|
|
681
684
|
await this.hooks.afterSetStatus(appuser, docstatus, createresult);
|
|
682
|
-
|
|
683
685
|
return createresult;
|
|
684
686
|
} else {
|
|
685
|
-
const
|
|
686
|
-
const newdata = { ...originalresult, ...data };
|
|
687
|
-
const updateresult = await this.findIdThenUpdate(appuser, id, newdata);
|
|
687
|
+
const updateresult = await this.findIdThenPatch(appuser, id, data);
|
|
688
688
|
const finaldata = await this.findById(appuser, id);
|
|
689
689
|
if (this.hooks.afterSetStatus)
|
|
690
690
|
await this.hooks.afterSetStatus(appuser, docstatus, finaldata);
|
|
@@ -763,7 +763,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
763
763
|
pipelines.push(stagefilter);
|
|
764
764
|
}
|
|
765
765
|
});
|
|
766
|
-
this.logger.
|
|
766
|
+
this.logger.debug(pipelines, 'identifyForeignKeys pipelines');
|
|
767
767
|
// this.doc.db.collection(collectionname);
|
|
768
768
|
const unionresult = await this.doc.aggregate(pipelines);
|
|
769
769
|
|
|
@@ -782,7 +782,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
782
782
|
searchresult[item.collection] = [item._id];
|
|
783
783
|
}
|
|
784
784
|
});
|
|
785
|
-
this.logger.
|
|
785
|
+
this.logger.debug(unionresult, this.documentType + ' search Result');
|
|
786
786
|
|
|
787
787
|
//search is it all foreign key exists in db
|
|
788
788
|
for (let i = 0; i < collections.length; i++) {
|
|
@@ -807,7 +807,7 @@ export class SimpleAppService<T extends { _id?: string }> {
|
|
|
807
807
|
`${this.documentType}: Foreignkey ${key} at collection ${collectionname} does not exist`,
|
|
808
808
|
'identifyForeignKeys',
|
|
809
809
|
);
|
|
810
|
-
this.logger.
|
|
810
|
+
this.logger.debug(appuser.getModifieds, 'appuser.getModifieds');
|
|
811
811
|
const errordata = { key: key, collection: collectionname };
|
|
812
812
|
throw new BadRequestException(
|
|
813
813
|
`${this.documentType}: Foreignkey ${key} at collection ${collectionname} does not exist`,
|
|
@@ -42,16 +42,21 @@ export type DefaultHooks<T> = {
|
|
|
42
42
|
afterValidation?: (appuser: UserContext, data: T) => Promise<void>;
|
|
43
43
|
beforeCreate?: (appuser: UserContext, data: T) => Promise<void>;
|
|
44
44
|
afterCreate?: (appuser: UserContext, data: T) => Promise<void>;
|
|
45
|
-
beforeUpdate?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
45
|
+
beforeUpdate?: (appuser: UserContext, id: string, data: T, existingdata:T) => Promise<void>;
|
|
46
46
|
afterUpdate?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
47
|
-
beforeDelete?: (appuser: UserContext, id: string) => Promise<void>;
|
|
48
|
-
afterDelete?: (
|
|
47
|
+
beforeDelete?: (appuser: UserContext, id: string,deletedata:T) => Promise<void>;
|
|
48
|
+
afterDelete?: (
|
|
49
|
+
appuser: UserContext,
|
|
50
|
+
result: DeleteResultType<T>,
|
|
51
|
+
id: string,
|
|
52
|
+
) => Promise<void>;
|
|
49
53
|
beforeFetchRecord?: (appuser: UserContext, id: string) => Promise<void>;
|
|
50
54
|
afterFetchRecord?: (appuser: UserContext, data: T) => Promise<void>;
|
|
51
55
|
beforeSetStatus?: (
|
|
52
56
|
appuser: UserContext,
|
|
53
57
|
id: string,
|
|
54
58
|
data: T,
|
|
59
|
+
existdata: T,
|
|
55
60
|
) => Promise<void>;
|
|
56
61
|
afterSetStatus?: (appuser: UserContext, id: string, data: T) => Promise<void>;
|
|
57
62
|
};
|
|
@@ -75,10 +80,10 @@ export type ApiEvent = {
|
|
|
75
80
|
errData?: any;
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
export type DeleteResultType
|
|
79
|
-
data:T
|
|
83
|
+
export type DeleteResultType<T> = {
|
|
84
|
+
data: T;
|
|
80
85
|
result: {
|
|
81
|
-
acknowledged: boolean
|
|
82
|
-
deletedCount:number
|
|
83
|
-
}
|
|
84
|
-
}
|
|
86
|
+
acknowledged: boolean;
|
|
87
|
+
deletedCount: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
.bodycolorclass {
|
|
9
|
+
@apply bg-gray-100 dark:bg-slate-800 dark:text-gray-300
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
[disabled=true],input[disabled] ,input[readonly] ,textarea[readonly]{
|
|
9
13
|
@apply bg-gray-300 dark:bg-gray-600
|
|
10
14
|
}
|
|
11
15
|
|
|
@@ -29,7 +33,7 @@ html {
|
|
|
29
33
|
} */
|
|
30
34
|
|
|
31
35
|
body {
|
|
32
|
-
@apply
|
|
36
|
+
@apply bodycolorclass h-screen w-screen
|
|
33
37
|
/* overflow-y-scroll overflow-x-scroll */
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -60,7 +64,10 @@ body {
|
|
|
60
64
|
@apply btn bg-primary-600 hover:bg-primary-400 dark:!bg-primary-700 dark:hover:bg-primary-800
|
|
61
65
|
}
|
|
62
66
|
.btn-secondary {
|
|
63
|
-
@apply btn bg-secondary-600 hover:bg-secondary-400
|
|
67
|
+
@apply btn bg-secondary-600 hover:bg-secondary-400 dark:bg-secondary-400 dark:hover:bg-secondary-600
|
|
68
|
+
}
|
|
69
|
+
.btn-default {
|
|
70
|
+
@apply btn bg-gray-600 hover:bg-gray-400 dark:bg-gray-400 hover:dark:bg-gray-500
|
|
64
71
|
}
|
|
65
72
|
.btn-danger {
|
|
66
73
|
@apply btn bg-danger-600 hover:bg-danger-400 dark:bg-danger-700 dark:hover:bg-danger-800
|
|
@@ -70,3 +77,32 @@ body {
|
|
|
70
77
|
}
|
|
71
78
|
|
|
72
79
|
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
.p-component-overlay-enter {
|
|
83
|
+
animation: p-component-overlay-enter-animation 150ms forwards;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.p-component-overlay-leave {
|
|
87
|
+
animation: p-component-overlay-leave-animation 150ms forwards;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.p-component-overlay {
|
|
91
|
+
@keyframes p-component-overlay-enter-animation {
|
|
92
|
+
from {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
to {
|
|
96
|
+
background-color: var(--maskbg);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes p-component-overlay-leave-animation {
|
|
101
|
+
from {
|
|
102
|
+
background-color: var(--maskbg);
|
|
103
|
+
}
|
|
104
|
+
to {
|
|
105
|
+
background-color: transparent;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -35,7 +35,7 @@ const CustomTailwind = usePassThrough(
|
|
|
35
35
|
selectbutton:{
|
|
36
36
|
root:{class:'flex flex-row gap-1 '},
|
|
37
37
|
button: ({ context }) => ({
|
|
38
|
-
class: ` focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600 ${context.active ? 'bg-primary-600 border-primary-400 text-white' : ''}`
|
|
38
|
+
class: ` focus:outline-none whitespace-nowrap transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600 ${context.active ? 'bg-primary-600 border-primary-400 text-white' : ''}`
|
|
39
39
|
}),
|
|
40
40
|
// button: ( context) => ({
|
|
41
41
|
|
|
@@ -43,20 +43,25 @@ const CustomTailwind = usePassThrough(
|
|
|
43
43
|
// }),
|
|
44
44
|
label:{class: 'text-sm dark:text-white'},
|
|
45
45
|
},
|
|
46
|
-
checkbox:{
|
|
47
|
-
|
|
48
|
-
// p-checkbox p-component cursor-pointer inline-flex relative select-none align-bottom w-6 h-6
|
|
49
|
-
|
|
50
|
-
},
|
|
46
|
+
//checkbox:{
|
|
47
|
+
// input:{ class:' flex items-center justify-center border-2 w-6 h-6 text-gray-600 rounded-lg transition-colors duration-200 border-gray-300 bg-white dark:border-blue-900/40 dark:bg-gray-500 hover:border-blue-500 dark:hover:border-blue-400 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[inset_0_0_0_0.2rem_rgba(147,197,253,0.5)]'}
|
|
48
|
+
// p-checkbox p-component cursor-pointer inline-flex relative select-none align-bottom w-6 h-6
|
|
49
|
+
//},
|
|
51
50
|
button:{root:{class: 'focus:outline-none transition duration-150 ease-in-out rounded p-2 m-1 border dark:border-gray-600'}},
|
|
52
51
|
dialog:{
|
|
53
|
-
root:{class:[' w-full max-h-full max-w-full md:h-3/4 lg:h-1/2 border m-2 rounded-lg']},
|
|
54
|
-
header:{class: 'p-dialog-header flex items-center text-2xl justify-between shrink-0
|
|
55
|
-
|
|
52
|
+
root:{class:[' w-full max-h-full bodycolorclass max-w-full md:h-3/4 lg:h-1/2 border m-2 rounded-lg']},
|
|
53
|
+
header:{class: 'p-dialog-header flex items-center text-2xl justify-between shrink-0 border-t-0 rounded-tl-lg rounded-tr-lg p-6 bodycolorclass'},
|
|
54
|
+
footer:{class:'p-dialog-footer flex gap-2 shrink-0 justify-end align-center border-t-0 px-6 pb-6 text-right rounded-b-lg bodycolorclass'},
|
|
55
|
+
content:{class:'p-dialog-content overflow-y-auto px-6 pb-8 pt-0 rounded-bl-lg rounded-br-lg h-full bodycolorclass'}
|
|
56
56
|
},
|
|
57
57
|
calendar:{
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
panel:{class:'p-datepicker p-component p-datepicker-mobile p-datepicker-touch-ui p-input-filled bg-white dark:bg-gray-900 min-w-[350px] shadow-md border-0 absolute'},
|
|
59
|
+
// group:{class:'p-datepicker-group flex-1 border-l border-gray-300 pr-0.5 pl-0.5 pt-0 pb-0 first:pl-0 first:border-l-0 w-2/3'},
|
|
60
|
+
// table:{class:'p-datepicker-calendar border-collapse w-2/3 my-2'},
|
|
61
|
+
// day:{class:'p-datepicker-other-month p-1'},
|
|
62
|
+
daylabel:{class:'w-8 h-8md:w-10 md:w-10 rounded-full transition-shadow duration-200 border-transparent border flex items-center justify-center mx-auto overflow-hidden relative focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] cursor-pointer text-gray-600 dark:text-gray-400 bg-transparent hover:bg-gray-200 dark:hover:bg-gray-800/80'},
|
|
63
|
+
// root:{class:'border border-grey-900 dark:!border-blue-900/40 rounded-lg flex flex-row p-0'},
|
|
64
|
+
// input:{class:'w-full p-inputtext p-component font-sans text-base text-gray-600 dark:text-white/80 bg-white dark:bg-gray-900 p-3 border border-gray-300 dark:border-blue-900/40 transition-colors duration-200 appearance-none hover:border-blue-500 rounded-lg'},
|
|
60
65
|
},
|
|
61
66
|
autocomplete:{
|
|
62
67
|
// root:{class:'border border-gray-400 dark:!border-blue-900/40 rounded-lg flex flex-row'},
|
|
@@ -74,7 +79,7 @@ const CustomTailwind = usePassThrough(
|
|
|
74
79
|
},
|
|
75
80
|
},
|
|
76
81
|
sidebar:{
|
|
77
|
-
root:{class:'w-full md:w-2/3
|
|
82
|
+
root:{class:'w-full md:w-2/3 bodycolorclass p-0 h-full'},
|
|
78
83
|
header:{class:'dark:text-white text-2xl p-2'},
|
|
79
84
|
content:{class:'p-0 pt-0 h-full w-full grow overflow-y-auto'}
|
|
80
85
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ButtonDefault v-if="!actionName" :animate="animate"><slot></slot>def</ButtonDefault>
|
|
3
|
+
<ButtonPrimary v-else-if="['create', 'update'].includes(actionName)" :animate="animate"
|
|
4
|
+
><slot></slot
|
|
5
|
+
></ButtonPrimary>
|
|
6
|
+
<ButtonDanger v-else-if="['delete', 'void'].includes(actionName)" :animate="animate"
|
|
7
|
+
><slot></slot
|
|
8
|
+
></ButtonDanger>
|
|
9
|
+
<ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
|
|
10
|
+
</template>
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
/**
|
|
13
|
+
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
14
|
+
* --remove-this-line-to-prevent-override--
|
|
15
|
+
* last change 2024-03-01
|
|
16
|
+
* author: Ks Tan
|
|
17
|
+
*/
|
|
18
|
+
const props = defineProps<{ actionName?: string; animate?:boolean }>();
|
|
19
|
+
</script>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Button
|
|
3
|
-
|
|
2
|
+
<Button
|
|
3
|
+
v-if="isMobile()"
|
|
4
|
+
:class="`w-full rounded-full text-center block dark:bg-danger-600 bg-danger-600 active:dark:bg-danger-400 text-white ${animate ? 'animate-bounce' :'' }`"
|
|
5
|
+
@click="onActivate"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</Button>
|
|
9
|
+
<Button v-else :class="`btn-danger ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
|
|
4
10
|
<slot></slot>
|
|
5
11
|
</Button>
|
|
6
12
|
</template>
|
|
@@ -11,8 +17,9 @@
|
|
|
11
17
|
* last change 2024-02-22
|
|
12
18
|
* author: Ks Tan
|
|
13
19
|
*/
|
|
14
|
-
const emits = defineEmits([
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const emits = defineEmits(["click"]);
|
|
21
|
+
const props = defineProps<{animate?:boolean}>()
|
|
22
|
+
const onActivate = (e: Event) => {
|
|
23
|
+
emits("click", e);
|
|
24
|
+
};
|
|
18
25
|
</script>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Button
|
|
3
|
-
|
|
2
|
+
<Button
|
|
3
|
+
v-if="isMobile()"
|
|
4
|
+
:class="`w-full rounded-full text-center block dark:bg-gray-600 bg-gray-600 active:dark:bg-gray-400 text-white ${animate ? 'animate-bounce' :'' }`"
|
|
5
|
+
@click="onActivate"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</Button>
|
|
9
|
+
<Button v-else :class="`btn-default ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
|
|
4
10
|
<slot></slot>
|
|
5
11
|
</Button>
|
|
6
12
|
</template>
|
|
@@ -11,8 +17,9 @@
|
|
|
11
17
|
* last change 2024-02-22
|
|
12
18
|
* author: Ks Tan
|
|
13
19
|
*/
|
|
14
|
-
const emits = defineEmits([
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const emits = defineEmits(["click"]);
|
|
21
|
+
const props = defineProps<{animate?:boolean}>()
|
|
22
|
+
const onActivate = (e: Event) => {
|
|
23
|
+
emits("click", e);
|
|
24
|
+
};
|
|
18
25
|
</script>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
4
|
-
o.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
o.
|
|
8
|
-
|
|
2
|
+
<div class="flex flex-row gap-2">
|
|
3
|
+
<div v-for="o in options" >
|
|
4
|
+
<ButtonPrimary v-if="value == o.value" @click="switchButton(o.value)">{{
|
|
5
|
+
o.label
|
|
6
|
+
}}</ButtonPrimary>
|
|
7
|
+
<ButtonDefault v-else @click="switchButton(o.value)">{{
|
|
8
|
+
o.label
|
|
9
|
+
}}</ButtonDefault>
|
|
10
|
+
</div>
|
|
9
11
|
</div>
|
|
10
12
|
</template>
|
|
11
13
|
<script setup lang="ts">
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Button
|
|
3
|
-
|
|
2
|
+
<Button
|
|
3
|
+
v-if="isMobile()"
|
|
4
|
+
:class="`w-full rounded-full text-center block dark:bg-primary-600 bg-primary-600 active:dark:bg-primary-400 text-white ${animate ? 'animate-bounce' :'' }`"
|
|
5
|
+
@click="onActivate"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</Button>
|
|
9
|
+
<Button v-else :class="`btn-primary ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
|
|
4
10
|
<slot></slot>
|
|
5
11
|
</Button>
|
|
6
12
|
</template>
|
|
@@ -11,8 +17,9 @@
|
|
|
11
17
|
* last change 2024-02-22
|
|
12
18
|
* author: Ks Tan
|
|
13
19
|
*/
|
|
14
|
-
const emits = defineEmits([
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const emits = defineEmits(["click"]);
|
|
21
|
+
const props = defineProps<{animate?:boolean}>()
|
|
22
|
+
const onActivate = (e: Event) => {
|
|
23
|
+
emits("click", e);
|
|
24
|
+
};
|
|
18
25
|
</script>
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Button
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
v-if="isMobile()"
|
|
4
|
+
@click="onActivate"
|
|
5
|
+
:class="`border-none dark:text-white active:text-primary-600 click:bg-gray-600 ${animate ? 'animate-bounce' :'' }`"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</Button>
|
|
9
|
+
<Button
|
|
10
|
+
v-else
|
|
11
|
+
@click="onActivate"
|
|
12
|
+
:class="`border-none dark:text-white active:text-primary-600 click:bg-gray-600 ${animate ? 'animate-bounce' :'' }`"
|
|
5
13
|
>
|
|
6
14
|
<slot></slot>
|
|
7
15
|
</Button>
|
|
@@ -13,9 +21,10 @@
|
|
|
13
21
|
* last change 2024-02-22
|
|
14
22
|
* author: Ks Tan
|
|
15
23
|
*/
|
|
16
|
-
const emits = defineEmits([
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
const emits = defineEmits(["click"]);
|
|
25
|
+
const props = defineProps<{animate?:boolean}>()
|
|
26
|
+
let stopawhile = false;
|
|
27
|
+
const onActivate = (e: Event) => {
|
|
28
|
+
emits("click", e);
|
|
29
|
+
};
|
|
21
30
|
</script>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Button
|
|
3
|
-
|
|
2
|
+
<Button
|
|
3
|
+
v-if="isMobile()"
|
|
4
|
+
:class="`w-full rounded-full text-center block dark:bg-warning-600 bg-warning-600 active:bg-warning-400 text-white ${animate ? 'animate-bounce' :'' }`"
|
|
5
|
+
@click="onActivate"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</Button>
|
|
9
|
+
<Button v-else :class="`btn-warn ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
|
|
4
10
|
<slot></slot>
|
|
5
11
|
</Button>
|
|
6
12
|
</template>
|
|
@@ -11,8 +17,9 @@
|
|
|
11
17
|
* last change 2024-02-22
|
|
12
18
|
* author: Ks Tan
|
|
13
19
|
*/
|
|
14
|
-
const emits = defineEmits([
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const emits = defineEmits(["click"]);
|
|
21
|
+
const props = defineProps<{animate?:boolean}>()
|
|
22
|
+
const onActivate = (e: Event) => {
|
|
23
|
+
emits("click", e);
|
|
24
|
+
};
|
|
18
25
|
</script>
|