This commit is contained in:
2025-10-17 14:37:48 +08:00
parent fe1ae0ccdf
commit 9e57d52769
12 changed files with 57 additions and 2443 deletions

File diff suppressed because one or more lines are too long

2377
src/assets/kuc.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,9 @@
import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData,StringValue, WhereCondition } from "@/types/model"; import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData,StringValue, WhereCondition } from "@/types/model";
import { type OneOf, isType } from "./field-types-mobile"; import { type OneOf, isType } from "./field-types-mobile";
import type { ConditionValue } from "./conditions"; import type { ConditionValue } from "./conditions";
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient; import { KintoneRestAPIClient } from '@kintone/rest-api-client';
import { MobileButton } from 'kintone-ui-component/lib/mobile/button';
import { Spinner } from 'kintone-ui-component/lib/spinner';
export class KintoneIndexEventHandler { export class KintoneIndexEventHandler {
private config: SavedData<FieldLayout>; private config: SavedData<FieldLayout>;
private currentApp: string; private currentApp: string;
@@ -23,8 +25,7 @@ export class KintoneIndexEventHandler {
// ボタン追加 // ボタン追加
if (document.getElementById('aggregator-plugin:btn-data-fetch')) return; if (document.getElementById('aggregator-plugin:btn-data-fetch')) return;
const kuc = Kucs['1.18.0']; const button = new MobileButton({
const button = new kuc.MobileButton({
text: this.config.buttonName, text: this.config.buttonName,
type: "submit", type: "submit",
id: 'aggregator-plugin:btn-data-fetch', id: 'aggregator-plugin:btn-data-fetch',
@@ -51,8 +52,7 @@ export class KintoneIndexEventHandler {
} }
private showSpinner() { private showSpinner() {
const kuc = Kucs['1.18.0']; const spinner = new Spinner({
const spinner = new kuc.Spinner({
text: 'データ収集中', text: 'データ収集中',
container: document.body container: document.body
}); });

View File

@@ -1,7 +1,9 @@
import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData, StringValue,WhereCondition } from "@/types/model"; import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData, StringValue,WhereCondition } from "@/types/model";
import { type OneOf, isType } from "./field-types"; import { type OneOf, isType } from "./field-types";
import type { ConditionValue } from "./conditions"; import type { ConditionValue } from "./conditions";
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient; import { KintoneRestAPIClient } from '@kintone/rest-api-client';
import { Button } from 'kintone-ui-component/lib/button';
import { Spinner } from 'kintone-ui-component/lib/spinner';
export class KintoneIndexEventHandler { export class KintoneIndexEventHandler {
private config: SavedData<FieldLayout>; private config: SavedData<FieldLayout>;
private currentApp: string; private currentApp: string;
@@ -23,8 +25,7 @@ export class KintoneIndexEventHandler {
// ボタン追加 // ボタン追加
if (document.getElementById('aggregator-plugin:btn-data-fetch')) return; if (document.getElementById('aggregator-plugin:btn-data-fetch')) return;
const kuc = Kucs['1.18.0']; const button = new Button({
const button = new kuc.Button({
text: this.config.buttonName, text: this.config.buttonName,
type: "submit", type: "submit",
id: 'aggregator-plugin:btn-data-fetch', id: 'aggregator-plugin:btn-data-fetch',
@@ -51,8 +52,7 @@ export class KintoneIndexEventHandler {
} }
private showSpinner() { private showSpinner() {
const kuc = Kucs['1.18.0']; const spinner = new Spinner({
const spinner = new kuc.Spinner({
text: 'データ収集中', text: 'データ収集中',
container: document.body container: document.body
}); });

View File

@@ -1,34 +1,32 @@
import type { Field, FieldLayout, SavedData } from "@/types/model"; import type { FieldLayout, SavedData } from '@/types/model';
import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler"; import { KintoneIndexEventHandler } from './KintoneIndexEventHandler';
(function (PLUGIN_ID) { (function (PLUGIN_ID) {
kintone.events.on('app.record.index.show', (event) => { kintone.events.on('app.record.index.show', (event) => {
try{ try {
const setting = kintone.plugin.app.getConfig(PLUGIN_ID); const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
const config:SavedData<FieldLayout> = getConfig(setting); const config: SavedData<FieldLayout> = getConfig(setting);
const currentApp = kintone.app.getId()?.toString(); const currentApp = kintone.app.getId()?.toString();
if(!currentApp) return; if (!currentApp) return;
const handler = new KintoneIndexEventHandler(config,currentApp); const handler = new KintoneIndexEventHandler(config, currentApp);
handler.init(); handler.init();
}catch(error){ } catch (error) {
const detailError =(error instanceof Error) ? "\n詳細:" + error.message : ""; const detailError = error instanceof Error ? '\n詳細:' + error.message : '';
const errorMsg = `データ収集中処理中例外発生しました。${ detailError }`; const errorMsg = `データ収集中処理中例外発生しました。${detailError}`;
event.error = errorMsg; event.error = errorMsg;
} }
return event; return event;
}); });
/** /**
* Config設定値を変換する * Config設定値を変換する
* @param setting * @param setting
* @returns * @returns
*/ */
function getConfig(setting:any):SavedData<FieldLayout>{ function getConfig(setting: any): SavedData<FieldLayout> {
const config:SavedData<FieldLayout>={ const config: SavedData<FieldLayout> = {
buttonName:setting.buttonName, buttonName: setting.buttonName,
joinTables:JSON.parse(setting.joinTables) joinTables: JSON.parse(setting.joinTables),
} };
return config; return config;
} }
})(kintone.$PLUGIN_ID); })(kintone.$PLUGIN_ID);

View File

@@ -1,4 +1,4 @@
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient; import { KintoneRestAPIClient } from '@kintone/rest-api-client';
const client = new KintoneRestAPIClient(); const client = new KintoneRestAPIClient();
export type Properties = Awaited<ReturnType<typeof client.app.getFormFields>>['properties']; export type Properties = Awaited<ReturnType<typeof client.app.getFormFields>>['properties'];
export type Layout = Awaited<ReturnType<typeof client.app.getFormLayout>>['layout']; export type Layout = Awaited<ReturnType<typeof client.app.getFormLayout>>['layout'];

View File

@@ -1,4 +1,4 @@
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient; import { KintoneRestAPIClient } from '@kintone/rest-api-client';
const client = new KintoneRestAPIClient(); const client = new KintoneRestAPIClient();
export type Properties = Awaited<ReturnType<typeof client.app.getFormFields>>['properties']; export type Properties = Awaited<ReturnType<typeof client.app.getFormFields>>['properties'];
export type Layout = Awaited<ReturnType<typeof client.app.getFormLayout>>['layout']; export type Layout = Awaited<ReturnType<typeof client.app.getFormLayout>>['layout'];

View File

@@ -1,32 +1,32 @@
import type { Field, FieldLayout, SavedData } from "@/types/model"; import type { FieldLayout, SavedData } from '@/types/model';
import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler.mobile"; import { KintoneIndexEventHandler } from './KintoneIndexEventHandler.mobile';
(function (PLUGIN_ID) { (function (PLUGIN_ID) {
kintone.events.on('mobile.app.record.index.show', (event) => { kintone.events.on('mobile.app.record.index.show', (event) => {
try{ try {
const setting = kintone.plugin.app.getConfig(PLUGIN_ID); const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
const config:SavedData<FieldLayout> = getConfig(setting); const config: SavedData<FieldLayout> = getConfig(setting);
const currentApp = kintone.mobile.app.getId()?.toString(); const currentApp = kintone.mobile.app.getId()?.toString();
if(!currentApp) return; if (!currentApp) return;
const handler = new KintoneIndexEventHandler(config,currentApp); const handler = new KintoneIndexEventHandler(config, currentApp);
handler.init(); handler.init();
}catch(error){ } catch (error) {
const detailError =(error instanceof Error) ? "\n詳細:" + error.message : ""; const detailError = error instanceof Error ? '\n詳細:' + error.message : '';
const errorMsg = `データ収集中処理中例外発生しました。${ detailError }`; const errorMsg = `データ収集中処理中例外発生しました。${detailError}`;
event.error = errorMsg; event.error = errorMsg;
} }
return event; return event;
}); });
/** /**
* Config設定値を変換する * Config設定値を変換する
* @param setting * @param setting
* @returns * @returns
*/ */
function getConfig(setting:any):SavedData<FieldLayout>{ function getConfig(setting: any): SavedData<FieldLayout> {
const config:SavedData<FieldLayout>={ const config: SavedData<FieldLayout> = {
buttonName:setting.buttonName, buttonName: setting.buttonName,
joinTables:JSON.parse(setting.joinTables) joinTables: JSON.parse(setting.joinTables),
} };
return config; return config;
} }
})(kintone.$PLUGIN_ID); })(kintone.$PLUGIN_ID);

View File

@@ -5,12 +5,9 @@
"type": "APP", "type": "APP",
"desktop": { "desktop": {
"js": [ "js": [
"js/KintoneRestAPIClient.min.js",
"js/kuc.min.js",
"js/desktop.js" "js/desktop.js"
], ],
"css": [ "css": [
"css/51-modern-default.css",
"css/desktop.css" "css/desktop.css"
] ]
}, },
@@ -38,8 +35,6 @@
}, },
"mobile": { "mobile": {
"js": [ "js": [
"js/KintoneRestAPIClient.min.js",
"js/kuc.min.js",
"js/mobile.js" "js/mobile.js"
], ],
"css": [ "css": [

View File

@@ -1,6 +1,3 @@
declare global { // 导出所有类型定义
const Kucs: { // 主要导出应用设置相关的类型接口
[version: string]: any; export * from './model';
};
}
export {};

View File

@@ -151,6 +151,7 @@ export default defineConfig({
}, },
}, },
build: { build: {
target: 'es2022',
rollupOptions: { rollupOptions: {
input: { input: {
config: path.resolve(__dirname, 'index.html'), config: path.resolve(__dirname, 'index.html'),
@@ -163,7 +164,7 @@ export default defineConfig({
}, },
}, },
sourcemap: isProd ? false : 'inline', // 生产环境关闭 sourcemap开发环境使用 inline sourcemap: isProd ? false : 'inline', // 生产环境关闭 sourcemap开发环境使用 inline
minify: isProd ? 'terser' : false, // 生产环境使用 terser 混淆,开发环境不混淆 minify: 'terser', // 强制进行混淆,避免全局变量被污染的问题
...(isProd && { ...(isProd && {
terserOptions: { terserOptions: {
compress: { compress: {

View File

@@ -22,6 +22,7 @@ function createIIFEConfig(platform: 'desktop' | 'mobile'): UserConfig {
global: 'window', global: 'window',
}, },
build: { build: {
target: 'es2022',
lib: { lib: {
entry: path.resolve(__dirname, `src/js/${platform}.ts`), entry: path.resolve(__dirname, `src/js/${platform}.ts`),
name: `${packageJson.name.replaceAll('-', '_')}_${platform}_iife`, name: `${packageJson.name.replaceAll('-', '_')}_${platform}_iife`,
@@ -38,7 +39,7 @@ function createIIFEConfig(platform: 'desktop' | 'mobile'): UserConfig {
}, },
outDir: path.resolve(__dirname, `dist-iife/${platform}`), // 输出到 dist-iife 目录 outDir: path.resolve(__dirname, `dist-iife/${platform}`), // 输出到 dist-iife 目录
sourcemap: isProd ? false : 'inline', // 生产环境关闭,开发环境使用 inline sourcemap: isProd ? false : 'inline', // 生产环境关闭,开发环境使用 inline
minify: isProd ? 'terser' : false, // 生产环境使用 terser 混淆,开发环境不混淆 minify: 'terser', // 强制进行混淆,避免全局变量被污染的问题
...(isProd && { ...(isProd && {
terserOptions: { terserOptions: {
compress: { compress: {