kintone側実装完了。PVC初回提出版

This commit is contained in:
2025-01-27 08:19:35 +09:00
parent bf4a55dd26
commit 88a83878d2
36 changed files with 103 additions and 6839 deletions

View File

@@ -1,13 +0,0 @@
module.exports = {
extends: [
'@cybozu/eslint-config/globals/kintone.js',
'@cybozu/eslint-config/lib/base.js',
'@cybozu/eslint-config/lib/kintone.js',
'@cybozu/eslint-config/lib/prettier.js',
],
rules: {
'prettier/prettier': ['error', { singleQuote: true }],
'space-before-function-paren': 0,
'object-curly-spacing': 0,
},
};

View File

@@ -1,15 +0,0 @@
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "localhost に対して Chrome を起動する",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
n<EFBFBD>mR<10><> ӹE<D3B9><45><EFBFBD>H<EFBFBD>ޥu<DEA5><75><EFBFBD><02><><EFBFBD><EFBFBD>?u<>OL<4F>luG<75><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>$v
/9R{t<><74>M<>v#>T<>D<EFBFBD>F<EFBFBD>0<EFBFBD><><7F>L<EFBFBD>kC<6B>i!<05>J<EFBFBD><10>o

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +0,0 @@
.settings-heading {
padding: 1em 0;
}
.kintoneplugin-input-text {
width: 20em;
}

View File

@@ -1,10 +0,0 @@
.plugin-space-heading {
font-size: 1.5rem;
margin: 0.8rem;
}
.plugin-space-message {
display: inline-block;
font-size: 1.2em;
margin: 0.8rem;
margin-top: 0;
}

View File

@@ -1,10 +0,0 @@
.plugin-space-heading {
font-size: 1.5rem;
margin: 0.8rem;
}
.plugin-space-message {
display: inline-block;
font-size: 1.2em;
margin: 0.8rem;
margin-top: 0;
}

View File

@@ -1,16 +0,0 @@
<section class="settings">
<h2 class="settings-heading">Settings for data fetch pluging</h2>
<p class="kintoneplugin-desc">This message is displayed on the app page after the app has been updated.</p>
<form class="js-submit-settings">
<p class="kintoneplugin-row">
<label for="message">
Message:
<input type="text" class="js-text-message kintoneplugin-input-text">
</label>
</p>
<p class="kintoneplugin-row">
<button type="button" class="js-cancel-button kintoneplugin-button-dialog-cancel">Cancel</button>
<button class="kintoneplugin-button-dialog-ok">Save</button>
</p>
</form>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

View File

@@ -1,25 +0,0 @@
(function (PLUGIN_ID) {
const formEl = document.querySelector('.js-submit-settings');
const cancelButtonEl = document.querySelector('.js-cancel-button');
const messageEl = document.querySelector('.js-text-message');
if (!(formEl && cancelButtonEl && messageEl)) {
throw new Error('Required elements do not exist.');
}
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
if (config.message) {
messageEl.value = config.message;
}
formEl.addEventListener('submit', (e) => {
e.preventDefault();
kintone.plugin.app.setConfig({ message: messageEl.value }, () => {
alert('The plug-in settings have been saved. Please update the app!');
window.location.href = '../../flow?app=' + kintone.app.getId();
});
});
cancelButtonEl.addEventListener('click', () => {
window.location.href = '../../' + kintone.app.getId() + '/plugin/';
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,23 +0,0 @@
(function (PLUGIN_ID) {
kintone.events.on('app.record.index.show', () => {
alert('app.record.index.show run by pluging');
const spaceEl = kintone.app.getHeaderSpaceElement();
if (spaceEl === null) {
throw new Error('The header element is unavailable on this page.');
}
const fragment = document.createDocumentFragment();
const headingEl = document.createElement('h3');
const messageEl = document.createElement('p');
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
messageEl.textContent = config.message;
messageEl.classList.add('plugin-space-message');
headingEl.textContent = 'Hello kintone plugin!';
headingEl.classList.add('plugin-space-heading');
fragment.appendChild(headingEl);
fragment.appendChild(messageEl);
spaceEl.appendChild(fragment);
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,22 +0,0 @@
(function (PLUGIN_ID) {
kintone.events.on('mobile.app.record.index.show', () => {
const spaceEl = kintone.mobile.app.getHeaderSpaceElement();
if (spaceEl === null) {
throw new Error('The header element is unavailable on this page.');
}
const fragment = document.createDocumentFragment();
const headingEl = document.createElement('h3');
const messageEl = document.createElement('p');
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
messageEl.textContent = config.message;
messageEl.classList.add('plugin-space-message');
headingEl.textContent = 'Hello kintone plugin!';
headingEl.classList.add('plugin-space-heading');
fragment.appendChild(headingEl);
fragment.appendChild(messageEl);
spaceEl.appendChild(fragment);
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,45 +0,0 @@
{
"$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,
"version": 2,
"type": "APP",
"desktop": {
"js": [
"js/desktop.js"
],
"css": [
"css/51-modern-default.css",
"css/desktop.css"
]
},
"icon": "image/icon.png",
"config": {
"html": "html/config.html",
"js": [
"js/config.js"
],
"css": [
"css/51-modern-default.css",
"css/config.css"
],
"required_params": [
"message"
]
},
"name": {
"en": "data fetch pluging",
"ja": "データ取得プラグイン"
},
"description": {
"en": "create search data pluging",
"ja": "検索結果のデータを生成するプラグインです"
},
"mobile": {
"js": [
"js/mobile.js"
],
"css": [
"css/mobile.css"
]
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +0,0 @@
{
"name": "data-fetch-pluging",
"version": "0.1.1",
"scripts": {
"build": "kintone-plugin-packer --ppk private.ppk --out dist/plugin.zip src",
"develop": "npm run build -- --watch",
"lint": "eslint src",
"start": "npm run develop",
"test":"kintone-plugin-packer --help"
},
"devDependencies": {
"@cybozu/eslint-config": "^23.0.0",
"@kintone/plugin-packer": "^8.1.3",
"eslint": "^8.57.0"
}
}

View File

@@ -1,15 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCF7z/zsYmoe+L1AYTeCYvy9yBXlsXOniTzox6svsXunibVP3y+
f1jEwu2cnTdp/GABOzsVHNSrYGedRDlwG93Y8qxe7qNKLZAFL6ujmJ0FJixuYrh4
xvaWR6SlKIbws+803qAyE6dUN893xeZeJdWGelZNBsCZu8Nwmi28k1flzQIDAQAB
AoGAbWJchJZ2qtejIB5BeWWqmqAiFebZXkniO+j44HReCue3J2pWYu52fRwGG2Z7
H2AyuE67jh6hweVWOibCEkFwCM+MwkSpKNRyFqJwdzZGoMm/oT67dDGYELrmNCx/
9G5DdLgLXsA2dAANxTybaK8wg123Hhrh7NwJDETn9OC+uzECQQDeJTq4OSK9qUw9
RCpgijpVdnzc4hC0CNjKe/+z8bQOPVcX7zLcggwX/7i2UmNxBxfYFrCN8XIGJNGN
VXMpUdCjAkEAmliRAdgAJvoMvaS+gCcJt9tU18F2aunnGudpdwMWDFYdsnztLSJQ
uLPsPQM0TJJYwXWZ+akQuReqXeKg4WgmzwJBAMZAg38VvqN1C81BoHA37IeJDzYx
qqaBnrhWoYV+GCr9I1UA7GtOxGxGlBpivMyKgAUher+y0wgYo8t2jyg5E/ECQCRH
JO42AvMmWtBIZK5ifppEZ1C/HEJM8BEWy2c5xnjn1NsbGfQ92JNRVvmQQz6sN0hh
h+tynYej1Ft05TOV82kCQQCDd0/JtINW3Myj2nWIe8c9IjsBUtNOkaCa13tGOzwJ
3G8Bg0GzdVSC73OnEaguC72kBvyGO4enUFkOq6p6kmFQ
-----END RSA PRIVATE KEY-----

View File

@@ -1,15 +0,0 @@
"use strict";
const runAll = require("npm-run-all");
runAll(["develop", "upload"], {
parallel: true,
stdout: process.stdout,
stdin: process.stdin
}).catch(({results}) => {
results
.filter(({code}) => code)
.forEach(({name}) => {
console.log(`"npm run ${name}" was failed`);
})
;
});

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +0,0 @@
.settings-heading {
padding: 1em 0;
}
.kintoneplugin-input-text {
width: 20em;
}

View File

@@ -1,10 +0,0 @@
.plugin-space-heading {
font-size: 1.5rem;
margin: 0.8rem;
}
.plugin-space-message {
display: inline-block;
font-size: 1.2em;
margin: 0.8rem;
margin-top: 0;
}

View File

@@ -1,10 +0,0 @@
.plugin-space-heading {
font-size: 1.5rem;
margin: 0.8rem;
}
.plugin-space-message {
display: inline-block;
font-size: 1.2em;
margin: 0.8rem;
margin-top: 0;
}

View File

@@ -1,16 +0,0 @@
<section class="settings">
<h2 class="settings-heading">Settings for data fetch pluging</h2>
<p class="kintoneplugin-desc">This message is displayed on the app page after the app has been updated.</p>
<form class="js-submit-settings">
<p class="kintoneplugin-row">
<label for="message">
Message:
<input type="text" class="js-text-message kintoneplugin-input-text">
</label>
</p>
<p class="kintoneplugin-row">
<button type="button" class="js-cancel-button kintoneplugin-button-dialog-cancel">Cancel</button>
<button class="kintoneplugin-button-dialog-ok">Save</button>
</p>
</form>
</section>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

View File

@@ -1,25 +0,0 @@
(function (PLUGIN_ID) {
const formEl = document.querySelector('.js-submit-settings');
const cancelButtonEl = document.querySelector('.js-cancel-button');
const messageEl = document.querySelector('.js-text-message');
if (!(formEl && cancelButtonEl && messageEl)) {
throw new Error('Required elements do not exist.');
}
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
if (config.message) {
messageEl.value = config.message;
}
formEl.addEventListener('submit', (e) => {
e.preventDefault();
kintone.plugin.app.setConfig({ message: messageEl.value }, () => {
alert('The plug-in settings have been saved. Please update the app!');
window.location.href = '../../flow?app=' + kintone.app.getId();
});
});
cancelButtonEl.addEventListener('click', () => {
window.location.href = '../../' + kintone.app.getId() + '/plugin/';
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,22 +0,0 @@
(function (PLUGIN_ID) {
kintone.events.on('app.record.index.show', () => {
const spaceEl = kintone.app.getHeaderSpaceElement();
if (spaceEl === null) {
throw new Error('The header element is unavailable on this page.');
}
const fragment = document.createDocumentFragment();
const headingEl = document.createElement('h3');
const messageEl = document.createElement('p');
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
messageEl.textContent = config.message;
messageEl.classList.add('plugin-space-message');
headingEl.textContent = 'Hello kintone plugin!';
headingEl.classList.add('plugin-space-heading');
fragment.appendChild(headingEl);
fragment.appendChild(messageEl);
spaceEl.appendChild(fragment);
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,22 +0,0 @@
(function (PLUGIN_ID) {
kintone.events.on('mobile.app.record.index.show', () => {
const spaceEl = kintone.mobile.app.getHeaderSpaceElement();
if (spaceEl === null) {
throw new Error('The header element is unavailable on this page.');
}
const fragment = document.createDocumentFragment();
const headingEl = document.createElement('h3');
const messageEl = document.createElement('p');
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
messageEl.textContent = config.message;
messageEl.classList.add('plugin-space-message');
headingEl.textContent = 'Hello kintone plugin!';
headingEl.classList.add('plugin-space-heading');
fragment.appendChild(headingEl);
fragment.appendChild(messageEl);
spaceEl.appendChild(fragment);
});
})(kintone.$PLUGIN_ID);

View File

@@ -1,45 +0,0 @@
{
"$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,
"version": 2,
"type": "APP",
"desktop": {
"js": [
"js/desktop.js"
],
"css": [
"css/51-modern-default.css",
"css/desktop.css"
]
},
"icon": "image/icon.png",
"config": {
"html": "html/config.html",
"js": [
"js/config.js"
],
"css": [
"css/51-modern-default.css",
"css/config.css"
],
"required_params": [
"message"
]
},
"name": {
"en": "data fetch pluging",
"ja": "データ取得プラグイン"
},
"description": {
"en": "create search data pluging",
"ja": "検索結果のデータを生成するプラグインです"
},
"mobile": {
"js": [
"js/mobile.js"
],
"css": [
"css/mobile.css"
]
}
}

View File

@@ -75,7 +75,7 @@ function save() {
const currentAppMeta = cachedData.currentAppFields.fields;
const convertJoinTables = JSON.parse(JSON.stringify(data.joinTables)) as JoinTable<OneOf | string>[];
convertJoinTables.forEach((item) => {
const meta = getMeta(item.meta as Properties, item.table);
const meta = getMeta(item.meta as Properties, item.table,true);
// Process onConditions
item.onConditions.forEach((condition) => {

View File

@@ -1,5 +1,6 @@
import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData, WhereCondition } from "@/types/model";
import { type OneOf ,isType} from "./field-types";
import { type OneOf, isType } from "./field-types";
import type { ConditionValue } from "./conditions";
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient;
export class KintoneIndexEventHandler {
private config: SavedData<FieldLayout>;
@@ -28,27 +29,36 @@ export class KintoneIndexEventHandler {
type: "submit",
id: 'btn-data-fetch',
});
// const button = document.createElement('button');
// button.id = 'btn-data-fetch';
// button.textContent = this.config.buttonName;
// button.style.margin = '0 8px';
button.addEventListener('click', () => this.handleButtonClick());
headerSpace.appendChild(button);
}
// ボタンクリック
private handleButtonClick = async (): Promise<void> => {
const spinner = this.showSpinner();
try {
console.log('データ収集開始...');
await this.execDataFectch();
spinner.close();
location.reload();
} catch (error) {
console.error('Error during data processing:', error);
throw error;
spinner.close();
const detailError = (error instanceof Error) ? "\n詳細:" + error.message : "";
const errorMsg = `データ収集中処理中例外発生しました。${detailError}`;
console.error(errorMsg, error);
window.alert(errorMsg);
}
}
private showSpinner() {
const kuc = Kucs['1.18.0'];
const spinner = new kuc.Spinner({
text: 'データ収集中',
container: document.body
});
spinner.open();
return spinner;
}
/**
* 検索データ取得&作成処理
@@ -68,6 +78,7 @@ export class KintoneIndexEventHandler {
for (const table of joinTables) {
const subDatas = await this.fetchDataFromApp(table);
mainData = this.leftJoin(mainData, subDatas, table);
// console.log("LeftJoin", mainData);
};
//現在のデータをクリアする
await this.deleteCurrentRecords();
@@ -82,11 +93,17 @@ export class KintoneIndexEventHandler {
private fetchDataFromApp = async (joinTable: JoinTable<FieldLayout>): Promise<Record[]> => {
// Filter 条件作成
const filter = this.getWhereCondition(joinTable.whereConditions);
//取得列を設定する
const fetchFields = joinTable.fieldsMapping.map(map => this.fieldCode(map.leftField));
if (joinTable.table) {
fetchFields.push(joinTable.table);
}
const onFields =joinTable.onConditions.map(cond=>this.fieldCode(cond.leftField));
onFields.forEach(fld=>{
if(!fetchFields.includes(fld)){
fetchFields.push(fld);
}
});
// KintoneRESTAPI
const client = new KintoneRestAPIClient();
const records = await client.record.getAllRecords({
@@ -94,24 +111,45 @@ export class KintoneIndexEventHandler {
fields: fetchFields,
condition: filter
});
//console.log("Data Fetch", records);
//SubTableが含まれる場合、フラットなデータに変換する
return this.convertToFlatDatas(records, joinTable.table);
}
/**
* 絞り込み条件式作成
* @param whereCondifions
* @returns
*/
private getWhereCondition(whereCondifions: WhereCondition<FieldLayout>[]): string {
const conds = whereCondifions
.filter((cond) => this.fieldCode(cond.field) !== '');
const condition = conds.map((cond) => {
const condValue = this.getConditionValue(cond);
return `${this.fieldCode(cond.field)} ${cond.condition} ${condValue}`;
let condition = cond.condition;
if ("subField" in cond.field && cond.field.subField) {
condition = this.mapConditionForSubField(cond.condition);
}
const condValue = this.getConditionValue(cond.field as OneOf, condition, cond.data);
return `${this.fieldCode(cond.field)} ${condition} ${condValue}`;
}).join(' and ');
return condition;
}
private getConditionValue(condi: WhereCondition<FieldLayout>): string {
const field = condi.field as OneOf;
const data = condi.data;
/**
* サブフィールドの演算子対応
* @param condition
* @returns
*/
private mapConditionForSubField(condition: ConditionValue): ConditionValue {
switch (condition) {
case "=":
return "in";
case "!=":
return "not in";
default:
return condition; // 既存の条件をそのまま使用
}
}
private getConditionValue(field: OneOf, condition: ConditionValue, data: string): string {
if (!data) return "";
if (isType.NUMBER(field) || isType.RECORD_NUMBER(field)) {
// For numbers, return as is
@@ -130,13 +168,13 @@ export class KintoneIndexEventHandler {
}
const dateTime = new Date(data);
return `"${dateTime.toISOString()}"`;
} else if ((condi.condition === "in" || condi.condition === "not in" )) {
if( data.includes(",")){
} else if ((condition === "in" || condition === "not in")) {
if (data.includes(",")) {
// Handle "in" and "not in" with comma-separated strings
const items = data.split(",").map(item => `"${item.trim()}"`);
return `(${items.join(",")})`;
} else {
return `"${data}"`;
return `("${data}")`;
}
} else {
// Default case for other types (treat as text)
@@ -182,7 +220,7 @@ export class KintoneIndexEventHandler {
// サブテーブルフィールドを抽出してフラットな構造に追加
Object.entries(nested.value).forEach(([key, field]) => {
flatRecord[key] = field.value;
flatRecord[key] = { value: field.value, type: field.type };
});
// テーブルフィールドを削除
@@ -198,7 +236,7 @@ export class KintoneIndexEventHandler {
flattenedData.push(flatRecord);
}
});
// console.log("FlatDatas=>", flattenedData);
return flattenedData;
}
@@ -215,58 +253,31 @@ export class KintoneIndexEventHandler {
subData: Record[],
joinTable: JoinTable<FieldLayout>
): Record[] {
const joinedRecords = mainData.map((mainRecord) => {
const matchedRecord = subData.find((subRecord) =>
const joinedRecords: Record[] = [];
mainData.forEach((mainRecord) => {
const matchedRecords = subData.filter((subRecord) =>
joinTable.onConditions.every(
(cond) => mainRecord[this.fieldCode(cond.leftField)] === subRecord[this.fieldCode(cond.rightField)]
(cond) => mainRecord[this.fieldCode(cond.rightField)]?.value === subRecord[this.fieldCode(cond.leftField)]?.value
)
);
// マッチ出来ない場合、LEFTの列のみ返す
if (!matchedRecord) return mainRecord;
// フィールド結合
const combinedRecord: Record = { ...mainRecord };
joinTable.fieldsMapping.forEach((mapping) => {
combinedRecord[this.fieldCode(mapping.rightField)] = matchedRecord[this.fieldCode(mapping.leftField)];
});
return combinedRecord;
if (!matchedRecords) {
joinedRecords.push(mainRecord);
} else {
matchedRecords.forEach((matchedRecord) => {
// フィールド結合
const combinedRecord: Record = { ...mainRecord };
joinTable.fieldsMapping.forEach((mapping) => {
combinedRecord[this.fieldCode(mapping.rightField)] = matchedRecord[this.fieldCode(mapping.leftField)];
});
joinedRecords.push(combinedRecord);
});
}
});
return joinedRecords;
}
/**
* 取得先はテーブルの場合の特別対応
*/
private leftJoinForTable(
mainData: Record[],
subData: Record[],
joinTable: JoinTable
): any[] {
return mainData.map((mainRecord) => {
const matchedRecord = subData.find((subRecord) => {
const subRows = subRecord[joinTable.table].value as Record[];
joinTable.onConditions.every(
(cond) => mainRecord[cond.leftField] === subRecord[cond.rightField]
)
}
);
// マッチ出来ない場合、LEFTの列のみ返す
if (!matchedRecord) return mainRecord;
// フィールド結合
const combinedRecord = { ...mainRecord };
joinTable.fieldsMapping.forEach((mapping) => {
combinedRecord[mapping.rightField] = matchedRecord[mapping.leftField];
});
return combinedRecord;
});
}
/**
* 現在アプリのすべてレコードを削除する
*/

View File

@@ -3,12 +3,18 @@ import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
(function (PLUGIN_ID) {
kintone.events.on('app.record.index.show', (event) => {
const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
const config:SavedData<FieldLayout> = getConfig(setting);
const currentApp = kintone.app.getId()?.toString();
if(!currentApp) return;
const handler = new KintoneIndexEventHandler(config,currentApp);
handler.init();
try{
const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
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;
}
return event;
});
/**
@@ -24,244 +30,5 @@ import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
return config;
}
// function getTestSetting(config:SavedData):SavedData{
// const retConfig :SavedData<FieldLayout> ={
// "buttonName": "集約する",
// "joinTables": [
// {
// "id": "m6c69ojr-bx9l8n9fm",
// "app": "140",
// "table": "",
// "onConditions": [
// {
// "leftField": "",
// "rightField": "",
// "id": "m6c69ojr-7pho6voer"
// }
// ],
// "fieldsMapping": [
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行_",
// "label": "社員番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行_",
// "label": "社員番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c69ojr-i75a82qvb"
// },
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__0",
// "label": "氏名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__0",
// "label": "氏名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c6v8sp-7yw58m6e9"
// }
// ],
// "whereConditions": [
// {
// "field": "",
// "condition": "",
// "data": "",
// "id": "m6c69ojr-az5k7bvp6"
// }
// ]
// },
// {
// "id": "m6c6u15u-yq4kzp31c",
// "app": "141",
// "table": "使用者テーブル",
// "onConditions": [
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "社員番号",
// "label": "社員番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行_",
// "label": "社員番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c6ue5e-k7yibisue"
// }
// ],
// "fieldsMapping": [
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "氏名",
// "label": "氏名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__0",
// "label": "氏名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c6ue5e-bjdpae18q"
// }
// ],
// "whereConditions": [
// {
// "field": "",
// "condition": "",
// "data": "",
// "id": "m6c6ue5e-1rf2v4l9m"
// }
// ]
// },
// {
// "id": "m6c6vrso-vr7a7v5h1",
// "app": "143",
// "table": "テーブル",
// "onConditions": [
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__1",
// "label": "資産管理番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__1",
// "label": "資産管理番号",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c6vx94-02xbd48xt"
// }
// ],
// "fieldsMapping": [
// {
// "leftField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__2",
// "label": "資産名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "rightField": {
// "type": "SINGLE_LINE_TEXT",
// "code": "文字列__1行__2",
// "label": "資産名",
// "noLabel": false,
// "required": false,
// "minLength": "",
// "maxLength": "",
// "expression": "",
// "hideExpression": false,
// "unique": false,
// "defaultValue": ""
// },
// "id": "m6c6vx94-t7d8juf6x"
// }
// ],
// "whereConditions": [
// {
// "field": "",
// "condition": "",
// "data": "",
// "id": "m6c6vx94-gbxhjgf8m"
// }
// ]
// }
// ]
// };
// return retConfig;
// }
})(kintone.$PLUGIN_ID);

View File

@@ -78,7 +78,7 @@ function flatFields(fields: Properties) {
const copy = JSON.parse(JSON.stringify(subField)) as typeof subField;
copy.label = '[' + field.code + '].' + subField.label;
subtableFields[subField.code] = copy;
})
});
}
});
return { ...fields, ...subtableFields };
@@ -191,14 +191,24 @@ export function getFieldObj(fieldCode: string, { fields }: FieldsInfo, subTableC
return meta[fieldCode];
}
export function getMeta(fields: Properties, subTableCode?: string) {
export function getMeta(fields: Properties, subTableCode?: string ,allField?:boolean) {
if (!fields || !subTableCode) {
return fields;
}
let meta = fields;
const table = meta[subTableCode];
if (isType.SUBTABLE(table)) {
meta = table.fields;
const subFields = table.fields; ;
Object.values(subFields).forEach(field=>{
if (typeof field === 'object' && field !== null) {
(field as Record<string, any>).subField = true;
}
});
if(allField){
meta={ ...fields, ...subFields };
}else{
meta=subFields;
}
}
return meta;
}

View File

@@ -80,6 +80,6 @@ export default defineConfig({
assetFileNames: 'src/[ext]/[name].[ext]',
},
},
sourcemap:'inline',
sourcemap:false,
}
})