3 Commits

Author SHA1 Message Date
7863f1aac3 update version to 1.0.1 2025-06-26 20:12:23 +09:00
03f3d2fcb0 add sort condition by field code 2025-06-26 20:09:43 +09:00
2d84e24d61 sort fields by label. 2025-06-26 19:59:25 +09:00
4 changed files with 305 additions and 268 deletions

547
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "kintone-plugin-filelookup", "name": "kintone-plugin-filelookup",
"version": "1.0.0", "version": "1.0.1",
"scripts": { "scripts": {
"prepare": "node scripts/prepare-private-key.js", "prepare": "node scripts/prepare-private-key.js",
"start": "node scripts/npm-start.js", "start": "node scripts/npm-start.js",
@@ -29,8 +29,8 @@
"@kintone/dts-gen": "^8.1.2", "@kintone/dts-gen": "^8.1.2",
"@kintone/plugin-uploader": "^9.1.5", "@kintone/plugin-uploader": "^9.1.5",
"@kintone/webpack-plugin-kintone-plugin": "^8.0.11", "@kintone/webpack-plugin-kintone-plugin": "^8.0.11",
"@rspack/cli": "^1.3.15", "@rspack/cli": "^1.4.0",
"@rspack/core": "^1.3.15", "@rspack/core": "^1.4.0",
"@shin-chan/kypes": "^0.0.7", "@shin-chan/kypes": "^0.0.7",
"@swc/helpers": "^0.5.17", "@swc/helpers": "^0.5.17",
"@types/react": "^19.1.8", "@types/react": "^19.1.8",
@@ -42,7 +42,7 @@
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"globals": "^16.2.0", "globals": "^16.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.5.3", "prettier": "^3.6.1",
"style-loader": "^4.0.0", "style-loader": "^4.0.0",
"typescript": "^5.8.3" "typescript": "^5.8.3"
} }

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.2.0/packages/plugin-manifest-validator/manifest-schema.json", "$schema": "https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.2.0/packages/plugin-manifest-validator/manifest-schema.json",
"manifest_version": 1, "manifest_version": 1,
"version": "1.0.0", "version": "1.0.1",
"type": "APP", "type": "APP",
"desktop": { "desktop": {
"js": ["js/desktop.js"] "js": ["js/desktop.js"]

View File

@@ -12,12 +12,24 @@ export interface PluginContext {
lookupFields: KintoneFormFieldProperty.Lookup[]; lookupFields: KintoneFormFieldProperty.Lookup[];
} }
const naturalCompare = (a: string, b: string): number => {
const locales = new Set<string>([...navigator.languages, 'en-US', 'ja-JP']);
return new Intl.Collator(Array.from(locales), {
sensitivity: 'variant',
numeric: true,
}).compare(a, b);
};
const filterAttachmentFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.File[] => { const filterAttachmentFields = (properties: KintoneFormFieldProperties): KintoneFormFieldProperty.File[] => {
return Object.values(properties).filter((property) => property.type === 'FILE'); return Object.values(properties)
.filter((property) => property.type === 'FILE')
.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).filter((property) => 'lookup' in property); return Object.values(properties)
.filter((property) => 'lookup' in property)
.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> => {