update version to 1.0.1 with minor fixes.

This commit is contained in:
2025-06-18 18:06:48 +09:00
parent 3f85eb8338
commit e37ac9aa4a
13 changed files with 1043 additions and 1000 deletions

1938
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "kintone-plugin-docx", "name": "kintone-plugin-docx",
"version": "1.0.0", "version": "1.0.1",
"scripts": { "scripts": {
"prepare": "node scripts/prepare-private-key.js", "prepare": "node scripts/prepare-private-key.js",
"start": "node scripts/npm-start.js", "start": "node scripts/npm-start.js",
@ -16,7 +16,7 @@
"angular-expressions": "^1.4.3", "angular-expressions": "^1.4.3",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"docxtemplater": "^3.63.2", "docxtemplater": "^3.65.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"moize": "^6.1.6", "moize": "^6.1.6",
"pizzip": "^3.2.0", "pizzip": "^3.2.0",
@ -30,17 +30,17 @@
"@kintone/dts-gen": "^8.1.2", "@kintone/dts-gen": "^8.1.2",
"@kintone/plugin-uploader": "^9.1.5", "@kintone/plugin-uploader": "^9.1.5",
"@kintone/webpack-plugin-kintone-plugin": "^8.0.11", "@kintone/webpack-plugin-kintone-plugin": "^8.0.11",
"@rspack/cli": "^1.3.13", "@rspack/cli": "^1.3.15",
"@rspack/core": "^1.3.13", "@rspack/core": "^1.3.15",
"@shin-chan/kypes": "^0.0.7", "@shin-chan/kypes": "^0.0.7",
"@swc/helpers": "^0.5.17", "@swc/helpers": "^0.5.17",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@types/react": "^19.1.6", "@types/react": "^19.1.8",
"@types/react-dom": "^19.1.5", "@types/react-dom": "^19.1.6",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "^7.1.2", "css-loader": "^7.1.2",
"env-cmd": "^10.1.0", "env-cmd": "^10.1.0",
"eslint": "^9.28.0", "eslint": "^9.29.0",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"globals": "^16.2.0", "globals": "^16.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.2.0/packages/plugin-manifest-validator/manifest-schema.json", "$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, "manifest_version": 1,
"version": "1.0.0", "version": "1.0.1",
"type": "APP", "type": "APP",
"desktop": { "desktop": {
"js": ["js/desktop.js"] "js": ["js/desktop.js"]

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginAlertProps { export type KintonePluginAlertProps = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginAlert: React.FC<KintonePluginAlertProps> = (props) => { const KintonePluginAlert: React.FC<KintonePluginAlertProps> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -2,16 +2,15 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginButtonProps { export type KintonePluginButtonProps = React.PropsWithChildren<{
className?: string; className?: string;
variant: 'normal' | 'disabled' | 'dialog-ok' | 'dialog-cancel'; variant: 'normal' | 'disabled' | 'dialog-ok' | 'dialog-cancel' | 'add-row-image' | 'remove-row-image';
type?: 'button' | 'submit' | 'reset'; type?: 'button' | 'submit' | 'reset';
onClick?: React.MouseEventHandler<HTMLButtonElement>; onClick?: React.MouseEventHandler<HTMLButtonElement>;
children: React.ReactNode; }>;
}
const KintonePluginButton: React.FC<KintonePluginButtonProps> = (props) => { const KintonePluginButton: React.FC<KintonePluginButtonProps> = (props) => {
const { className, variant, type, onClick, children } = props; const { className, variant, type = 'button', onClick, children } = props;
return ( return (
<button <button
className={clsx(`kintoneplugin-button-${variant}`, className)} className={clsx(`kintoneplugin-button-${variant}`, className)}

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginDescProps { export type KintonePluginDescProps = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginDesc: React.FC<KintonePluginDescProps> = (props) => { const KintonePluginDesc: React.FC<KintonePluginDescProps> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginLabelProps { export type KintonePluginLabelProps = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginLabel: React.FC<KintonePluginLabelProps> = (props) => { const KintonePluginLabel: React.FC<KintonePluginLabelProps> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginRequire { export type KintonePluginRequire = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginRequire: React.FC<KintonePluginRequire> = (props) => { const KintonePluginRequire: React.FC<KintonePluginRequire> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginRowProps { export type KintonePluginRowProps = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginRow: React.FC<KintonePluginRowProps> = (props) => { const KintonePluginRow: React.FC<KintonePluginRowProps> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -2,32 +2,42 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
export interface KintonePluginSelectOptionData { export type KintonePluginSelectOptionData = {
key: string;
value: string; value: string;
label: string; label: string;
disabled?: boolean; disabled?: boolean;
} };
interface KintonePluginSelectProps { export type KintonePluginSelectProps = {
className?: string; className?: string;
defaultValue?: string; value: string;
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void; onChange: (value: string) => void;
options: KintonePluginSelectOptionData[]; options: KintonePluginSelectOptionData[];
} };
const KintonePluginSelect: React.FC<KintonePluginSelectProps> = (props) => { const KintonePluginSelect: React.FC<KintonePluginSelectProps> = (props) => {
const { className, defaultValue, onChange, options } = props; const { className, value, onChange, options } = props;
if (!options || options.length === 0) { const optionWithKeys = React.useMemo(
return null; // Return null if no options are provided () =>
options.map((option) => ({
...option,
key: crypto.randomUUID(),
})),
[options],
);
if (options.length === 0) {
return null;
} }
const handleOnChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
onChange(e.target.value);
};
return ( return (
<div className={clsx('kintoneplugin-select-outer', className)}> <div className={clsx('kintoneplugin-select-outer', className)}>
<div className="kintoneplugin-select"> <div className="kintoneplugin-select">
<select defaultValue={defaultValue} onChange={onChange}> <select value={value} onChange={handleOnChange}>
{options.map((option) => ( {optionWithKeys.map(({ key, value: itemValue, label, disabled }) => (
<option key={option.key} value={option.value} disabled={option.disabled}> <option key={key} value={itemValue} disabled={disabled}>
{option.label} {label}
</option> </option>
))} ))}
</select> </select>

View File

@ -2,10 +2,9 @@ import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
interface KintonePluginTitleProps { export type KintonePluginTitleProps = React.PropsWithChildren<{
className?: string; className?: string;
children: React.ReactNode; }>;
}
const KintonePluginTitle: React.FC<KintonePluginTitleProps> = (props) => { const KintonePluginTitle: React.FC<KintonePluginTitleProps> = (props) => {
const { className, children } = props; const { className, children } = props;

View File

@ -29,11 +29,10 @@ const Settings: React.FC = () => {
const properties = React.use(cachedFormFieldsProperties(appId)); const properties = React.use(cachedFormFieldsProperties(appId));
const fileFields = Object.values(properties).filter((property) => property.type === 'FILE'); const fileFields = Object.values(properties).filter((property) => property.type === 'FILE');
const options: KintonePluginSelectOptionData[] = [ const options: KintonePluginSelectOptionData[] = [
{ key: '-', value: '', label: 'Select a File field', disabled: true }, // Default option { value: '', label: 'Select a File field', disabled: true }, // Default option
...fileFields.map((property) => ({ ...fileFields.map((property) => ({
key: property.code,
value: property.code, value: property.code,
label: property.label, label: `${property.label} (${property.code})`,
})), })),
]; ];
@ -49,8 +48,8 @@ const Settings: React.FC = () => {
}); });
}; };
const handleOnChangeTemplate = (e: React.ChangeEvent<HTMLSelectElement>) => { const handleOnChangeTemplate = (value: string) => {
setTemplate(e.target.value); setTemplate(value);
}; };
const handleOnClickCancel = () => { const handleOnClickCancel = () => {
@ -71,7 +70,7 @@ const Settings: React.FC = () => {
No file fields found in the app. Please add a file field to use this plugin. No file fields found in the app. Please add a file field to use this plugin.
</KintonePluginAlert> </KintonePluginAlert>
) : ( ) : (
<KintonePluginSelect defaultValue={template} onChange={handleOnChangeTemplate} options={options} /> <KintonePluginSelect value={template} onChange={handleOnChangeTemplate} options={options} />
)} )}
</KintonePluginRow> </KintonePluginRow>
<KintonePluginRow className={styles.buttons}> <KintonePluginRow className={styles.buttons}>

View File

@ -229,6 +229,7 @@ const MenuPanel: React.FC<MenuPanelProps> = (props) => {
paragraphLoop: true, paragraphLoop: true,
linebreaks: true, linebreaks: true,
parser: expressionParser, parser: expressionParser,
nullGetter: () => '',
}); });
doc.render(record2data(properties, event.record)); doc.render(record2data(properties, event.record));
const out = doc.getZip().generate({ type: 'blob', mimeType: DOCX_CONTENT_TYPE }); const out = doc.getZip().generate({ type: 'blob', mimeType: DOCX_CONTENT_TYPE });