kintone側実装完了。PVC初回提出版
This commit is contained in:
@@ -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,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
15
data-fetch-pluging/.vscode/launch.json
vendored
15
data-fetch-pluging/.vscode/launch.json
vendored
@@ -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}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
BIN
data-fetch-pluging/dist/plugin.zip
vendored
BIN
data-fetch-pluging/dist/plugin.zip
vendored
Binary file not shown.
BIN
data-fetch-pluging/dist/plugin/PUBKEY
vendored
BIN
data-fetch-pluging/dist/plugin/PUBKEY
vendored
Binary file not shown.
2
data-fetch-pluging/dist/plugin/SIGNATURE
vendored
2
data-fetch-pluging/dist/plugin/SIGNATURE
vendored
@@ -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
|
|
||||||
BIN
data-fetch-pluging/dist/plugin/contents.zip
vendored
BIN
data-fetch-pluging/dist/plugin/contents.zip
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
|||||||
.settings-heading {
|
|
||||||
padding: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kintoneplugin-input-text {
|
|
||||||
width: 20em;
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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 |
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
4803
data-fetch-pluging/package-lock.json
generated
4803
data-fetch-pluging/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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-----
|
|
||||||
@@ -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
@@ -1,7 +0,0 @@
|
|||||||
.settings-heading {
|
|
||||||
padding: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kintoneplugin-input-text {
|
|
||||||
width: 20em;
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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 |
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
@@ -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);
|
|
||||||
@@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -75,7 +75,7 @@ function save() {
|
|||||||
const currentAppMeta = cachedData.currentAppFields.fields;
|
const currentAppMeta = cachedData.currentAppFields.fields;
|
||||||
const convertJoinTables = JSON.parse(JSON.stringify(data.joinTables)) as JoinTable<OneOf | string>[];
|
const convertJoinTables = JSON.parse(JSON.stringify(data.joinTables)) as JoinTable<OneOf | string>[];
|
||||||
convertJoinTables.forEach((item) => {
|
convertJoinTables.forEach((item) => {
|
||||||
const meta = getMeta(item.meta as Properties, item.table);
|
const meta = getMeta(item.meta as Properties, item.table,true);
|
||||||
|
|
||||||
// Process onConditions
|
// Process onConditions
|
||||||
item.onConditions.forEach((condition) => {
|
item.onConditions.forEach((condition) => {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { FieldLayout, FieldsJoinMapping, JoinTable, Record, RecordForParameter, SavedData, WhereCondition } from "@/types/model";
|
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;
|
declare var KintoneRestAPIClient: typeof import("@kintone/rest-api-client").KintoneRestAPIClient;
|
||||||
export class KintoneIndexEventHandler {
|
export class KintoneIndexEventHandler {
|
||||||
private config: SavedData<FieldLayout>;
|
private config: SavedData<FieldLayout>;
|
||||||
@@ -28,27 +29,36 @@ export class KintoneIndexEventHandler {
|
|||||||
type: "submit",
|
type: "submit",
|
||||||
id: 'btn-data-fetch',
|
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());
|
button.addEventListener('click', () => this.handleButtonClick());
|
||||||
|
|
||||||
headerSpace.appendChild(button);
|
headerSpace.appendChild(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ボタンクリック
|
// ボタンクリック
|
||||||
private handleButtonClick = async (): Promise<void> => {
|
private handleButtonClick = async (): Promise<void> => {
|
||||||
|
const spinner = this.showSpinner();
|
||||||
try {
|
try {
|
||||||
console.log('データ収集開始...');
|
console.log('データ収集開始...');
|
||||||
await this.execDataFectch();
|
await this.execDataFectch();
|
||||||
|
spinner.close();
|
||||||
|
location.reload();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error during data processing:', error);
|
spinner.close();
|
||||||
throw error;
|
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) {
|
for (const table of joinTables) {
|
||||||
const subDatas = await this.fetchDataFromApp(table);
|
const subDatas = await this.fetchDataFromApp(table);
|
||||||
mainData = this.leftJoin(mainData, subDatas, table);
|
mainData = this.leftJoin(mainData, subDatas, table);
|
||||||
|
// console.log("LeftJoin", mainData);
|
||||||
};
|
};
|
||||||
//現在のデータをクリアする
|
//現在のデータをクリアする
|
||||||
await this.deleteCurrentRecords();
|
await this.deleteCurrentRecords();
|
||||||
@@ -82,11 +93,17 @@ export class KintoneIndexEventHandler {
|
|||||||
private fetchDataFromApp = async (joinTable: JoinTable<FieldLayout>): Promise<Record[]> => {
|
private fetchDataFromApp = async (joinTable: JoinTable<FieldLayout>): Promise<Record[]> => {
|
||||||
// Filter 条件作成
|
// Filter 条件作成
|
||||||
const filter = this.getWhereCondition(joinTable.whereConditions);
|
const filter = this.getWhereCondition(joinTable.whereConditions);
|
||||||
|
//取得列を設定する
|
||||||
const fetchFields = joinTable.fieldsMapping.map(map => this.fieldCode(map.leftField));
|
const fetchFields = joinTable.fieldsMapping.map(map => this.fieldCode(map.leftField));
|
||||||
if (joinTable.table) {
|
if (joinTable.table) {
|
||||||
fetchFields.push(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
|
// KintoneRESTAPI
|
||||||
const client = new KintoneRestAPIClient();
|
const client = new KintoneRestAPIClient();
|
||||||
const records = await client.record.getAllRecords({
|
const records = await client.record.getAllRecords({
|
||||||
@@ -94,24 +111,45 @@ export class KintoneIndexEventHandler {
|
|||||||
fields: fetchFields,
|
fields: fetchFields,
|
||||||
condition: filter
|
condition: filter
|
||||||
});
|
});
|
||||||
|
//console.log("Data Fetch", records);
|
||||||
//SubTableが含まれる場合、フラットなデータに変換する
|
//SubTableが含まれる場合、フラットなデータに変換する
|
||||||
return this.convertToFlatDatas(records, joinTable.table);
|
return this.convertToFlatDatas(records, joinTable.table);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 絞り込み条件式作成
|
||||||
|
* @param whereCondifions
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
private getWhereCondition(whereCondifions: WhereCondition<FieldLayout>[]): string {
|
private getWhereCondition(whereCondifions: WhereCondition<FieldLayout>[]): string {
|
||||||
const conds = whereCondifions
|
const conds = whereCondifions
|
||||||
.filter((cond) => this.fieldCode(cond.field) !== '');
|
.filter((cond) => this.fieldCode(cond.field) !== '');
|
||||||
const condition = conds.map((cond) => {
|
const condition = conds.map((cond) => {
|
||||||
const condValue = this.getConditionValue(cond);
|
let condition = cond.condition;
|
||||||
return `${this.fieldCode(cond.field)} ${cond.condition} ${condValue}`;
|
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 ');
|
}).join(' and ');
|
||||||
return condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
private getConditionValue(condi: WhereCondition<FieldLayout>): string {
|
* サブフィールドの演算子対応
|
||||||
const field = condi.field as OneOf;
|
* @param condition
|
||||||
const data = condi.data;
|
* @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 (!data) return "";
|
||||||
if (isType.NUMBER(field) || isType.RECORD_NUMBER(field)) {
|
if (isType.NUMBER(field) || isType.RECORD_NUMBER(field)) {
|
||||||
// For numbers, return as is
|
// For numbers, return as is
|
||||||
@@ -130,13 +168,13 @@ export class KintoneIndexEventHandler {
|
|||||||
}
|
}
|
||||||
const dateTime = new Date(data);
|
const dateTime = new Date(data);
|
||||||
return `"${dateTime.toISOString()}"`;
|
return `"${dateTime.toISOString()}"`;
|
||||||
} else if ((condi.condition === "in" || condi.condition === "not in" )) {
|
} else if ((condition === "in" || condition === "not in")) {
|
||||||
if( data.includes(",")){
|
if (data.includes(",")) {
|
||||||
// Handle "in" and "not in" with comma-separated strings
|
// Handle "in" and "not in" with comma-separated strings
|
||||||
const items = data.split(",").map(item => `"${item.trim()}"`);
|
const items = data.split(",").map(item => `"${item.trim()}"`);
|
||||||
return `(${items.join(",")})`;
|
return `(${items.join(",")})`;
|
||||||
} else {
|
} else {
|
||||||
return `"${data}"`;
|
return `("${data}")`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Default case for other types (treat as text)
|
// Default case for other types (treat as text)
|
||||||
@@ -182,7 +220,7 @@ export class KintoneIndexEventHandler {
|
|||||||
|
|
||||||
// サブテーブルフィールドを抽出してフラットな構造に追加
|
// サブテーブルフィールドを抽出してフラットな構造に追加
|
||||||
Object.entries(nested.value).forEach(([key, field]) => {
|
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);
|
flattenedData.push(flatRecord);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// console.log("FlatDatas=>", flattenedData);
|
||||||
return flattenedData;
|
return flattenedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,58 +253,31 @@ export class KintoneIndexEventHandler {
|
|||||||
subData: Record[],
|
subData: Record[],
|
||||||
joinTable: JoinTable<FieldLayout>
|
joinTable: JoinTable<FieldLayout>
|
||||||
): Record[] {
|
): Record[] {
|
||||||
|
const joinedRecords: Record[] = [];
|
||||||
const joinedRecords = mainData.map((mainRecord) => {
|
mainData.forEach((mainRecord) => {
|
||||||
const matchedRecord = subData.find((subRecord) =>
|
const matchedRecords = subData.filter((subRecord) =>
|
||||||
joinTable.onConditions.every(
|
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の列のみ返す
|
// マッチ出来ない場合、LEFTの列のみ返す
|
||||||
if (!matchedRecord) return mainRecord;
|
if (!matchedRecords) {
|
||||||
|
joinedRecords.push(mainRecord);
|
||||||
|
} else {
|
||||||
|
matchedRecords.forEach((matchedRecord) => {
|
||||||
// フィールド結合
|
// フィールド結合
|
||||||
const combinedRecord: Record = { ...mainRecord };
|
const combinedRecord: Record = { ...mainRecord };
|
||||||
joinTable.fieldsMapping.forEach((mapping) => {
|
joinTable.fieldsMapping.forEach((mapping) => {
|
||||||
combinedRecord[this.fieldCode(mapping.rightField)] = matchedRecord[this.fieldCode(mapping.leftField)];
|
combinedRecord[this.fieldCode(mapping.rightField)] = matchedRecord[this.fieldCode(mapping.leftField)];
|
||||||
});
|
});
|
||||||
return combinedRecord;
|
joinedRecords.push(combinedRecord);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return joinedRecords;
|
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;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 現在アプリのすべてレコードを削除する
|
* 現在アプリのすべてレコードを削除する
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,12 +3,18 @@ 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{
|
||||||
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){
|
||||||
|
const detailError =(error instanceof Error) ? "\n詳細:" + error.message : "";
|
||||||
|
const errorMsg = `データ収集中処理中例外発生しました。${ detailError }`;
|
||||||
|
event.error = errorMsg;
|
||||||
|
}
|
||||||
return event;
|
return event;
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
@@ -24,244 +30,5 @@ import { KintoneIndexEventHandler } from "./KintoneIndexEventHandler";
|
|||||||
return config;
|
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);
|
})(kintone.$PLUGIN_ID);
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function flatFields(fields: Properties) {
|
|||||||
const copy = JSON.parse(JSON.stringify(subField)) as typeof subField;
|
const copy = JSON.parse(JSON.stringify(subField)) as typeof subField;
|
||||||
copy.label = '[' + field.code + '].' + subField.label;
|
copy.label = '[' + field.code + '].' + subField.label;
|
||||||
subtableFields[subField.code] = copy;
|
subtableFields[subField.code] = copy;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return { ...fields, ...subtableFields };
|
return { ...fields, ...subtableFields };
|
||||||
@@ -191,14 +191,24 @@ export function getFieldObj(fieldCode: string, { fields }: FieldsInfo, subTableC
|
|||||||
return meta[fieldCode];
|
return meta[fieldCode];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMeta(fields: Properties, subTableCode?: string) {
|
export function getMeta(fields: Properties, subTableCode?: string ,allField?:boolean) {
|
||||||
if (!fields || !subTableCode) {
|
if (!fields || !subTableCode) {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
let meta = fields;
|
let meta = fields;
|
||||||
const table = meta[subTableCode];
|
const table = meta[subTableCode];
|
||||||
if (isType.SUBTABLE(table)) {
|
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;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,6 @@ export default defineConfig({
|
|||||||
assetFileNames: 'src/[ext]/[name].[ext]',
|
assetFileNames: 'src/[ext]/[name].[ext]',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sourcemap:'inline',
|
sourcemap:false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user