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 OneOf, isType } from "./field-types-mobile";
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 {
private config: SavedData<FieldLayout>;
private currentApp: string;
@@ -23,8 +25,7 @@ export class KintoneIndexEventHandler {
// ボタン追加
if (document.getElementById('aggregator-plugin:btn-data-fetch')) return;
const kuc = Kucs['1.18.0'];
const button = new kuc.MobileButton({
const button = new MobileButton({
text: this.config.buttonName,
type: "submit",
id: 'aggregator-plugin:btn-data-fetch',
@@ -51,8 +52,7 @@ export class KintoneIndexEventHandler {
}
private showSpinner() {
const kuc = Kucs['1.18.0'];
const spinner = new kuc.Spinner({
const spinner = new Spinner({
text: 'データ収集中',
container: document.body
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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