From 03f3d2fcb060010f232a6be86a95d15332864590 Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Thu, 26 Jun 2025 20:09:43 +0900 Subject: [PATCH] add sort condition by field code --- src/common/context.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/context.ts b/src/common/context.ts index 4baf585..9795eec 100644 --- a/src/common/context.ts +++ b/src/common/context.ts @@ -23,13 +23,13 @@ const naturalCompare = (a: string, b: string): number => { const filterAttachmentFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.File[] => { return Object.values(properties) .filter((property) => property.type === 'FILE') - .sort((a, b) => naturalCompare(a.label, b.label)); + .sort((a, b) => naturalCompare(`${a.label} (${a.code})`, `${b.label} (${b.code})`)); }; const filterLookupFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.Lookup[] => { return Object.values(properties) .filter((property) => 'lookup' in property) - .sort((a, b) => naturalCompare(a.label, b.label)); + .sort((a, b) => naturalCompare(`${a.label} (${a.code})`, `${b.label} (${b.code})`)); }; const getFormFieldsProperties = async (appId: KintoneAppId): Promise => {