@kengcom202/kcore-ui 0.5.0 → 0.7.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kengcom202/kcore-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Angular UI กลาง: ช่องเลือกวันที่แบบ พ.ศ., ช่องเลือกเวลาแบบหน้าปัด, dropdown ค้นหาได้, ตัวแก้ข้อความไทยที่คัดลอกจาก PDF และชุดหน้าเข้าสู่ระบบ/ลงทะเบียน/ข้อมูลส่วนตัว/config (ไม่พึ่งไลบรารีภายนอก)",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -324,6 +324,8 @@ export declare function fixThaiText(text: string): string;
|
|
|
324
324
|
* ผ่าน execCommand('insertText') เพื่อให้ ngModel / formControl ได้ event input และ Ctrl+Z ย้อนได้
|
|
325
325
|
*/
|
|
326
326
|
export declare function provideThaiPasteFix(): EnvironmentProviders;
|
|
327
|
+
/** โหมดลงทะเบียนผู้ใช้ใหม่ — ดู KcAuthOptions.register */
|
|
328
|
+
export type KcRegisterMode = 'none' | 'form' | 'sso' | 'thaid';
|
|
327
329
|
/** ค่าที่โปรเจกต์ส่งให้ provideKcAuth() — ทุกค่ายกเว้น appName มีค่าเริ่มต้น */
|
|
328
330
|
export interface KcAuthOptions {
|
|
329
331
|
/** ชื่อระบบ แสดงบนหน้าเข้าสู่ระบบ/ลงทะเบียน */
|
|
@@ -339,7 +341,7 @@ export interface KcAuthOptions {
|
|
|
339
341
|
label?: string;
|
|
340
342
|
};
|
|
341
343
|
/**
|
|
342
|
-
* เปิดปุ่ม ThaiD (แอปยืนยันตัวตนของกรมการปกครอง) — เข้าสู่ระบบอย่างเดียว ไม่ใช้ลงทะเบียน
|
|
344
|
+
* เปิดปุ่ม ThaiD (แอปยืนยันตัวตนของกรมการปกครอง) — เข้าสู่ระบบอย่างเดียว ไม่ใช้ลงทะเบียน (ยกเว้น register: 'thaid')
|
|
343
345
|
* API จับคู่เลขบัตรประชาชนกับบัญชีที่มีอยู่แล้ว ไม่พบ = แจ้งให้ติดต่อผู้ดูแล; label ค่าเริ่มต้น 'ThaiD'; false/ไม่ใส่ = ปิด
|
|
344
346
|
*/
|
|
345
347
|
thaid?: false | {
|
|
@@ -355,8 +357,16 @@ export interface KcAuthOptions {
|
|
|
355
357
|
* 'none' — ไม่เปิดให้สมัครเอง (ผู้ดูแลเพิ่มให้) — ค่าเริ่มต้น
|
|
356
358
|
* 'form' — กรอกฟอร์มเองที่ /register
|
|
357
359
|
* 'sso' — ยืนยันตัวตนผ่าน SSO ก่อน แล้ว API ส่งตั๋วลงทะเบียนมาให้กรอกต่อที่ /register
|
|
360
|
+
* 'thaid' — ยืนยันตัวตนผ่าน ThaiD ก่อน แล้ว API ส่งตั๋วลงทะเบียนมาให้กรอกต่อที่ /register (ต้องเปิด thaid)
|
|
361
|
+
* สำหรับระบบที่เป็นหลังบ้านของ SSO เท่านั้น — SSO ไม่พบบัญชีตอบ { mode: 'thaid' } ส่งต่อไป ThaiD ได้
|
|
358
362
|
*/
|
|
359
|
-
register?:
|
|
363
|
+
register?: KcRegisterMode;
|
|
364
|
+
/**
|
|
365
|
+
* ให้ผู้ใช้ขอย้ายหน่วยงานเองที่หน้าบัญชีของฉัน ค่าเริ่มต้น false (ย้ายได้โดยผู้ดูแลที่หน้า config เท่านั้น)
|
|
366
|
+
* true = แสดงช่องเลือกหน่วยงานเมื่อ GET {api}/user/me ส่ง orgs มา แล้วส่ง org ไปกับ PUT {api}/user/me
|
|
367
|
+
* (API ตัดสินเองว่าย้ายทันทีหรือรออนุมัติ แล้วตอบ { message })
|
|
368
|
+
*/
|
|
369
|
+
profileOrgChange?: boolean;
|
|
360
370
|
/** ชื่อเรียกหน่วยงานที่สังกัด เช่น 'หน่วยงาน', 'โรงพยาบาล', 'แผนก' ค่าเริ่มต้น 'หน่วยงาน' */
|
|
361
371
|
orgLabel?: string;
|
|
362
372
|
/** ค่า role ที่ถือว่าเป็นผู้ดูแล (เข้า kcAdminGuard ได้) ค่าเริ่มต้น ['admin'] */
|
|
@@ -379,7 +389,8 @@ export interface KcAuthConfig {
|
|
|
379
389
|
label: string;
|
|
380
390
|
} | null;
|
|
381
391
|
passwordLogin: boolean;
|
|
382
|
-
register:
|
|
392
|
+
register: KcRegisterMode;
|
|
393
|
+
profileOrgChange: boolean;
|
|
383
394
|
orgLabel: string;
|
|
384
395
|
adminRoles: string[];
|
|
385
396
|
passwordMinLength: number;
|
|
@@ -442,12 +453,25 @@ export interface KcLoginMethods {
|
|
|
442
453
|
sso: boolean;
|
|
443
454
|
thaid: boolean;
|
|
444
455
|
}
|
|
445
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* POST {api}/user/sso/callback { code }
|
|
458
|
+
* thaid — ไม่พบบัญชี ให้ยืนยันตัวตนด้วย ThaiD ต่อ (ใช้ได้เฉพาะ register: 'thaid')
|
|
459
|
+
*/
|
|
446
460
|
export type KcSsoCallbackResult = ({
|
|
447
461
|
mode: 'signed-in';
|
|
448
462
|
} & KcSession) | {
|
|
449
463
|
mode: 'register';
|
|
450
464
|
ticket: string;
|
|
465
|
+
} | {
|
|
466
|
+
mode: 'thaid';
|
|
467
|
+
};
|
|
468
|
+
/**
|
|
469
|
+
* POST {api}/user/thaid/callback { code } — พบบัญชี = KcSession
|
|
470
|
+
* ไม่พบบัญชี: ปกติ 403 { message }; register: 'thaid' ตอบตั๋วลงทะเบียนแทนได้
|
|
471
|
+
*/
|
|
472
|
+
export type KcThaidCallbackResult = KcSession | {
|
|
473
|
+
mode: 'register';
|
|
474
|
+
ticket: string;
|
|
451
475
|
};
|
|
452
476
|
/** GET {api}/user/register-info[?ticket=] — ตั๋วจาก SSO ทำให้ได้ชื่อ-สกุล (และหน่วยงาน) ที่ยืนยันแล้ว */
|
|
453
477
|
export interface KcRegisterInfo {
|
|
@@ -485,6 +509,8 @@ export interface KcProfile {
|
|
|
485
509
|
orgName: string;
|
|
486
510
|
email: string;
|
|
487
511
|
mobile: string;
|
|
512
|
+
/** หน่วยงานที่ขอย้ายไปได้ — ใช้เมื่อ profileOrgChange: true (ไม่ส่ง/ว่าง = แสดงหน่วยงานแบบอ่านอย่างเดียว) */
|
|
513
|
+
orgs?: SearchOption[];
|
|
488
514
|
}
|
|
489
515
|
/** PUT {api}/user/me — password ว่าง = ไม่เปลี่ยน */
|
|
490
516
|
export interface KcProfileUpdate {
|
|
@@ -492,6 +518,8 @@ export interface KcProfileUpdate {
|
|
|
492
518
|
email: string;
|
|
493
519
|
mobile: string;
|
|
494
520
|
password: string;
|
|
521
|
+
/** ส่งเฉพาะเมื่อ profileOrgChange: true และ GET user/me ส่ง orgs มา */
|
|
522
|
+
org?: string;
|
|
495
523
|
}
|
|
496
524
|
/** แถวในหน้า config ผู้ใช้ */
|
|
497
525
|
export interface KcConfigUser {
|
|
@@ -635,7 +663,7 @@ export declare const KC_LOGIN_LOCK_KEY = "kc_login_lock";
|
|
|
635
663
|
* หน้าเข้าสู่ระบบ (route /login จาก kcAuthRoutes())
|
|
636
664
|
* ชื่อผู้ใช้/รหัสผ่าน → POST {api}/user/login → KcSession (ผิดครบ 3 ครั้ง API ตอบ 429 → นับถอยหลังตาม retryAfter และปิดปุ่ม)
|
|
637
665
|
* ปุ่ม SSO (ถ้าเปิด) → GET {api}/user/sso/authorize-url → ไปหน้า SSO แล้วกลับมาที่ /sso-callback
|
|
638
|
-
* ปุ่ม ThaiD (ถ้าเปิด) → GET {api}/user/thaid/authorize-url → ไปหน้า ThaiD แล้วกลับมาที่ /thaid-callback (
|
|
666
|
+
* ปุ่ม ThaiD (ถ้าเปิด) → GET {api}/user/thaid/authorize-url → ไปหน้า ThaiD แล้วกลับมาที่ /thaid-callback (ลงทะเบียนเฉพาะ register: 'thaid')
|
|
639
667
|
* วิธีที่แสดงตาม GET {api}/user/login-methods (ผู้ดูแลเปิด/ปิดที่หน้า config ผู้ใช้) — ไม่มี endpoint = ตาม provideKcAuth
|
|
640
668
|
* query: returnUrl = หน้าที่จะกลับไปหลังเข้าสู่ระบบ, expired=1 = แจ้งหมดเวลาการใช้งาน
|
|
641
669
|
* เนื้อหาที่ใส่ไว้ใน <kc-login>...</kc-login> แสดงท้ายการ์ด (เช่นเบอร์ติดต่อผู้ดูแล)
|
|
@@ -653,7 +681,7 @@ export declare class KcLoginComponent implements OnInit {
|
|
|
653
681
|
private readonly router;
|
|
654
682
|
private readonly route;
|
|
655
683
|
private readonly doc;
|
|
656
|
-
protected readonly busy: import("@angular/core").WritableSignal<"" | "sso" | "
|
|
684
|
+
protected readonly busy: import("@angular/core").WritableSignal<"" | "sso" | "thaid" | "password">;
|
|
657
685
|
/**
|
|
658
686
|
* วิธีที่ผู้ดูแลเปิดไว้ (GET {api}/user/login-methods) — ก่อนได้คำตอบ หรือ API ยังไม่มี endpoint นี้ ใช้ค่าจาก provideKcAuth
|
|
659
687
|
* แต่ละวิธีแสดงเมื่อทั้ง provideKcAuth เปิดไว้ (passwordLogin / sso / thaid) และผู้ดูแลเปิด
|
|
@@ -707,6 +735,7 @@ export declare class KcLoginComponent implements OnInit {
|
|
|
707
735
|
* หน้าลงทะเบียนผู้ใช้ใหม่ (route /register) — รูปแบบตาม ictprocure: กล่องเดียว ช่องเรียงแถวเดียว
|
|
708
736
|
* ทำงานตาม register ใน provideKcAuth()
|
|
709
737
|
* 'sso' — ต้องมาจาก /sso-callback พร้อมตั๋ว ชื่อ-สกุล / เลขบัตรประชาชน (และหน่วยงานถ้า orgLocked) มาจาก API แก้ไม่ได้
|
|
738
|
+
* 'thaid' — เหมือน 'sso' แต่ตั๋วมาจาก /thaid-callback
|
|
710
739
|
* 'form' — กรอกชื่อ-สกุลเอง
|
|
711
740
|
* 'none' — แจ้งว่าไม่เปิดให้ลงทะเบียน
|
|
712
741
|
* อีเมล / มือถือไม่ถามตอนลงทะเบียน — ผู้ใช้กรอกต่อที่หน้าบัญชีของฉัน
|
|
@@ -720,6 +749,7 @@ export declare class KcRegisterComponent implements OnInit {
|
|
|
720
749
|
readonly ssoCallback: "/sso-callback";
|
|
721
750
|
readonly thaidCallback: "/thaid-callback";
|
|
722
751
|
};
|
|
752
|
+
/** ผู้ยืนยันตัวตนของตั๋วลงทะเบียน — แสดงใน "(จาก ...)" และข้อความเมื่อยังไม่มีตั๋ว */
|
|
723
753
|
protected readonly ssoLabel: string;
|
|
724
754
|
private readonly auth;
|
|
725
755
|
private readonly http;
|
|
@@ -775,6 +805,10 @@ declare abstract class KcExternalCallbackBase implements OnInit {
|
|
|
775
805
|
/** แลก code แล้วจัดการผล */
|
|
776
806
|
protected abstract exchange(code: string): void;
|
|
777
807
|
ngOnInit(): void;
|
|
808
|
+
/** ขอ url ของผู้ให้บริการ เก็บ state แล้วพาไปหน้านั้น */
|
|
809
|
+
protected startFlow(endpoint: string, stateKey: string, label: string): void;
|
|
810
|
+
/** เก็บตั๋วลงทะเบียนแล้วไปหน้า /register (ตั๋วจาก SSO และ ThaiD ใช้คีย์เดียวกัน) */
|
|
811
|
+
protected toRegister(ticket: string): void;
|
|
778
812
|
protected signIn(session: KcSession): void;
|
|
779
813
|
protected fail(message: string): void;
|
|
780
814
|
static ɵfac: i0.ɵɵFactoryDeclaration<KcExternalCallbackBase, never>;
|
|
@@ -786,6 +820,7 @@ declare abstract class KcExternalCallbackBase implements OnInit {
|
|
|
786
820
|
* ?code=&state= → ตรวจ state → POST {api}/user/sso/callback { code }
|
|
787
821
|
* signed-in → เริ่ม session แล้วกลับหน้าเดิม / homeUrl
|
|
788
822
|
* register → เก็บตั๋วไว้ใน sessionStorage แล้วไป /register
|
|
823
|
+
* thaid → (register: 'thaid') ไม่พบบัญชี ส่งต่อไปยืนยันตัวตนด้วย ThaiD
|
|
789
824
|
* ไม่มี code (เช่นเปิดจากเมนูของ SSO portal) → เริ่ม flow ใหม่เอง
|
|
790
825
|
*/
|
|
791
826
|
export declare class KcSsoCallbackComponent extends KcExternalCallbackBase {
|
|
@@ -800,6 +835,7 @@ export declare class KcSsoCallbackComponent extends KcExternalCallbackBase {
|
|
|
800
835
|
* หน้ารับ redirect กลับจาก ThaiD (route /thaid-callback) — เข้าสู่ระบบอย่างเดียว ไม่มีการลงทะเบียน
|
|
801
836
|
* ?code=&state= → ตรวจ state → POST {api}/user/thaid/callback { code } → KcSession
|
|
802
837
|
* API ไม่พบบัญชีที่ผูกกับเลขบัตรประชาชน = ตอบ 403 { message } แสดงข้อความนั้น (ให้ติดต่อผู้ดูแล)
|
|
838
|
+
* ยกเว้น register: 'thaid' — API ตอบ { mode: 'register', ticket } ได้ → เก็บตั๋วแล้วไป /register
|
|
803
839
|
*/
|
|
804
840
|
export declare class KcThaidCallbackComponent extends KcExternalCallbackBase {
|
|
805
841
|
protected readonly label: string;
|
|
@@ -813,6 +849,7 @@ export declare class KcThaidCallbackComponent extends KcExternalCallbackBase {
|
|
|
813
849
|
* หน้า "บัญชีของฉัน" (user/detail) — รูปแบบตาม ictprocure: กล่องเดียวกลางหน้า ช่องเรียงแถวเดียว
|
|
814
850
|
* วางใน layout ของโปรเจกต์พร้อม canActivate: [kcAuthGuard]
|
|
815
851
|
* ชื่อ-สกุลและหน่วยงานแสดงอย่างเดียว (หน่วยงานกำหนดสิทธิ์การเห็นข้อมูล ย้ายได้โดยผู้ดูแลที่หน้า config)
|
|
852
|
+
* ยกเว้น profileOrgChange: true และ API ส่ง orgs มา — เลือกหน่วยงานได้ ส่ง org ไปกับ PUT (API ตัดสินว่ารออนุมัติไหม)
|
|
816
853
|
* แก้ได้: อีเมล มือถือ ชื่อผู้ใช้ รหัสผ่าน — เปลี่ยนรหัสผ่านไม่ต้องกรอกรหัสเดิม เว้นว่าง = ไม่เปลี่ยน
|
|
817
854
|
* GET {api}/user/me → KcProfile, PUT {api}/user/me ← KcProfileUpdate
|
|
818
855
|
*/
|
|
@@ -828,10 +865,13 @@ export declare class KcProfileComponent implements OnInit {
|
|
|
828
865
|
protected readonly success: import("@angular/core").WritableSignal<string>;
|
|
829
866
|
protected readonly fullName: import("@angular/core").WritableSignal<string>;
|
|
830
867
|
protected readonly orgName: import("@angular/core").WritableSignal<string>;
|
|
868
|
+
/** หน่วยงานที่เลือกย้ายได้ — ว่าง = แสดงแบบอ่านอย่างเดียว */
|
|
869
|
+
protected readonly orgs: import("@angular/core").WritableSignal<SearchOption[]>;
|
|
831
870
|
protected readonly form: import("@angular/forms").FormGroup<{
|
|
832
871
|
email: import("@angular/forms").FormControl<string>;
|
|
833
872
|
mobile: import("@angular/forms").FormControl<string>;
|
|
834
873
|
username: import("@angular/forms").FormControl<string>;
|
|
874
|
+
org: import("@angular/forms").FormControl<string>;
|
|
835
875
|
password: import("@angular/forms").FormControl<string>;
|
|
836
876
|
confirmPassword: import("@angular/forms").FormControl<string>;
|
|
837
877
|
}>;
|
|
@@ -853,6 +893,8 @@ interface UserEdit extends KcConfigUserUpdate {
|
|
|
853
893
|
* ค้นหา แล้วคลิกแถวเพื่อแก้ ชื่อผู้ใช้ / ระดับผู้ใช้ / สถานะ / หน่วยงาน / ตั้งรหัสผ่านใหม่
|
|
854
894
|
* ไม่มีการลบ — ใช้ "ระงับการใช้งาน" แทน และแก้ระดับ/สถานะของตัวเองไม่ได้ (กันผู้ดูแลล็อกตัวเองออก)
|
|
855
895
|
* GET {api}/config/users → { users, orgs, roles }, PUT {api}/config/users/{id} ← KcConfigUserUpdate
|
|
896
|
+
* [org] (ไม่บังคับ) — หน่วยงานที่จะดู ส่งเป็น ?org= (เช่นจากตัวเลือกหน่วยงานบน header ของโปรเจกต์) เปลี่ยนค่า = โหลดใหม่
|
|
897
|
+
* API ตัดสินเองว่าผู้เรียกดูหน่วยงานนั้นได้ไหม
|
|
856
898
|
* ส่วนบน: เปิด/ปิดวิธีเข้าสู่ระบบ (รหัสผ่าน / SSO / ThaiD ที่ provideKcAuth เปิดไว้) ห้ามปิดหมด
|
|
857
899
|
* GET {api}/user/login-methods → KcLoginMethods, PUT {api}/config/login-methods ← KcLoginMethods (ไม่มี endpoint = ซ่อนส่วนนี้)
|
|
858
900
|
*/
|
|
@@ -860,6 +902,8 @@ export declare class KcConfigUsersComponent implements OnInit {
|
|
|
860
902
|
protected readonly config: import("@kengcom202/kcore-ui").KcAuthConfig;
|
|
861
903
|
private readonly auth;
|
|
862
904
|
private readonly http;
|
|
905
|
+
/** หน่วยงานที่จะดู ('' = ให้ API เลือกเอง เช่นหน่วยงานของผู้เรียก) — ส่งเป็น ?org= */
|
|
906
|
+
readonly org: import("@angular/core").InputSignal<string>;
|
|
863
907
|
protected readonly users: import("@angular/core").WritableSignal<KcConfigUser[]>;
|
|
864
908
|
protected readonly orgs: import("@angular/core").WritableSignal<SearchOption[]>;
|
|
865
909
|
protected readonly roles: import("@angular/core").WritableSignal<SearchOption[]>;
|
|
@@ -903,7 +947,13 @@ export declare class KcConfigUsersComponent implements OnInit {
|
|
|
903
947
|
protected close(): void;
|
|
904
948
|
protected save(): void;
|
|
905
949
|
static ɵfac: i0.ɵɵFactoryDeclaration<KcConfigUsersComponent, never>;
|
|
906
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<KcConfigUsersComponent, "kc-config-users", never, {
|
|
950
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<KcConfigUsersComponent, "kc-config-users", never, {
|
|
951
|
+
"org": {
|
|
952
|
+
"alias": "org";
|
|
953
|
+
"required": false;
|
|
954
|
+
"isSignal": true;
|
|
955
|
+
};
|
|
956
|
+
}, {}, never, never, true, never>;
|
|
907
957
|
}
|
|
908
958
|
/**
|
|
909
959
|
* หน้า config › ข้อมูลอ้างอิง (ตาราง kcllu) เฉพาะผู้ดูแล — วางใน layout ของโปรเจกต์พร้อม canActivate: [kcAdminGuard]
|