Kintone側実装
This commit is contained in:
1
vue-project/my-kintone-plugin/src/assets/KintoneRestAPIClient.min.js
vendored
Normal file
1
vue-project/my-kintone-plugin/src/assets/KintoneRestAPIClient.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,28 +1,119 @@
|
||||
import type { SavedData } from "@/types/model";
|
||||
import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
|
||||
|
||||
(function (PLUGIN_ID) {
|
||||
kintone.events.on('app.record.index.show', (event) => {
|
||||
const config = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
const setting = kintone.plugin.app.getConfig(PLUGIN_ID);
|
||||
const config:SavedData = getConfig(setting);
|
||||
const handler = new KintoneIndexEventHandler(config);
|
||||
handler.init();
|
||||
// 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);
|
||||
handler.init();
|
||||
return event;
|
||||
});
|
||||
/**
|
||||
* Config設定値を変換する
|
||||
* @param setting
|
||||
* @returns
|
||||
*/
|
||||
function getConfig(setting:any):SavedData{
|
||||
const config:SavedData={
|
||||
buttonName:setting.buttonName,
|
||||
joinTables:JSON.parse(setting.joinTables)
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
function getTestSetting(config:SavedData):SavedData{
|
||||
const mainTable = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const leftJoinTable1 = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const leftJoinTable2 = {
|
||||
id:12345,
|
||||
app:"140",
|
||||
onConditions:[
|
||||
{
|
||||
leftField:"文字列__1行_",
|
||||
rightField:"文字列__1行_"
|
||||
}
|
||||
],
|
||||
fieldsMapping:[{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
},
|
||||
{
|
||||
leftField:"",
|
||||
rightField:""
|
||||
}
|
||||
],
|
||||
table:"",
|
||||
whereConditions:[
|
||||
{
|
||||
field:"",
|
||||
condition:"",
|
||||
data:""
|
||||
}
|
||||
]
|
||||
};
|
||||
const retConfig :SavedData ={
|
||||
buttonName : config.buttonName,
|
||||
joinTables:[
|
||||
mainTable,
|
||||
leftJoinTable1,
|
||||
leftJoinTable2
|
||||
]
|
||||
};
|
||||
return retConfig;
|
||||
}
|
||||
|
||||
})(kintone.$PLUGIN_ID);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"type": "APP",
|
||||
"desktop": {
|
||||
"js": [
|
||||
"js/KintoneRestAPIClient.min.js",
|
||||
"js/kuc.min.js",
|
||||
"js/desktop.js"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user