add sort condition by field code
This commit is contained in:
@@ -23,13 +23,13 @@ const naturalCompare = (a: string, b: string): number => {
|
|||||||
const filterAttachmentFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.File[] => {
|
const filterAttachmentFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.File[] => {
|
||||||
return Object.values(properties)
|
return Object.values(properties)
|
||||||
.filter((property) => property.type === 'FILE')
|
.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[] => {
|
const filterLookupFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.Lookup[] => {
|
||||||
return Object.values(properties)
|
return Object.values(properties)
|
||||||
.filter((property) => 'lookup' in property)
|
.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<KintoneFormFieldProperties> => {
|
const getFormFieldsProperties = async (appId: KintoneAppId): Promise<KintoneFormFieldProperties> => {
|
||||||
|
Reference in New Issue
Block a user