From b3decf965fa15fbc35bf4641bfdeafa1c645b902 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 24 Dec 2022 11:57:06 +0900 Subject: [PATCH] =?UTF-8?q?pages=E9=96=A2=E9=80=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 251 ---------------- .../page-editor/els/page-editor.el.button.vue | 70 ----- .../page-editor/els/page-editor.el.canvas.vue | 38 --- .../els/page-editor.el.counter.vue | 34 --- .../page-editor/els/page-editor.el.if.vue | 67 ----- .../page-editor/els/page-editor.el.image.vue | 23 +- .../page-editor/els/page-editor.el.note.vue | 35 ++- .../els/page-editor.el.number-input.vue | 34 --- .../page-editor/els/page-editor.el.post.vue | 31 -- .../els/page-editor.el.radio-button.vue | 39 --- .../els/page-editor.el.section.vue | 58 ++-- .../page-editor/els/page-editor.el.switch.vue | 34 --- .../els/page-editor.el.text-input.vue | 27 -- .../page-editor/els/page-editor.el.text.vue | 25 +- .../els/page-editor.el.textarea-input.vue | 28 -- .../els/page-editor.el.textarea.vue | 45 --- .../pages/page-editor/page-editor.blocks.vue | 55 ++-- .../page-editor/page-editor.container.vue | 6 +- .../page-editor/page-editor.script-block.vue | 279 ------------------ .../src/pages/page-editor/page-editor.vue | 185 ++---------- packages/client/src/pages/page.vue | 1 + 21 files changed, 137 insertions(+), 1228 deletions(-) delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.button.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.canvas.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.counter.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.if.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.number-input.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.post.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.radio-button.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.switch.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.text-input.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.textarea-input.vue delete mode 100644 packages/client/src/pages/page-editor/els/page-editor.el.textarea.vue delete mode 100644 packages/client/src/pages/page-editor/page-editor.script-block.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6abb44dc58..98e435a6b5 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1489,8 +1489,6 @@ _pages: eyeCatchingImageRemove: "アイキャッチ画像を削除" chooseBlock: "ブロックを追加" selectType: "種類を選択" - enterVariableName: "変数名を決めてください" - variableNameIsAlreadyUsed: "その変数名は既に使われています" contentBlocks: "コンテンツ" inputBlocks: "入力" specialBlocks: "特殊" @@ -1501,261 +1499,12 @@ _pages: image: "画像" button: "ボタン" - if: "もし" - _if: - variable: "変数" - - post: "投稿フォーム" - _post: - text: "内容" - attachCanvasImage: "キャンバスの画像を添付する" - canvasId: "キャンバスID" - - textInput: "テキスト入力" - _textInput: - name: "変数名" - text: "タイトル" - default: "デフォルト値" - - textareaInput: "複数行テキスト入力" - _textareaInput: - name: "変数名" - text: "タイトル" - default: "デフォルト値" - - numberInput: "数値入力" - _numberInput: - name: "変数名" - text: "タイトル" - default: "デフォルト値" - - canvas: "キャンバス" - _canvas: - id: "キャンバスID" - width: "幅" - height: "高さ" - note: "ノート埋め込み" _note: id: "ノートID" idDescription: "ノートURLをペーストして設定することもできます。" detailed: "詳細な表示" - switch: "スイッチ" - _switch: - name: "変数名" - text: "タイトル" - default: "デフォルト値" - - counter: "カウンター" - _counter: - name: "変数名" - text: "タイトル" - inc: "増加値" - - _button: - text: "タイトル" - colored: "色付き" - action: "ボタンを押したときの動作" - _action: - dialog: "ダイアログを表示する" - _dialog: - content: "内容" - resetRandom: "乱数をリセット" - pushEvent: "イベントを送信させる" - _pushEvent: - event: "イベント名" - message: "押したときに表示するメッセージ" - variable: "送信する変数" - no-variable: "なし" - callAiScript: "AiScript呼び出し" - _callAiScript: - functionName: "関数名" - - radioButton: "選択肢" - _radioButton: - name: "変数名" - title: "タイトル" - values: "改行で区切った選択肢" - default: "デフォルト値" - - script: - categories: - flow: "制御" - logical: "論理演算" - operation: "計算" - comparison: "比較" - random: "ランダム" - value: "値" - fn: "関数" - text: "テキスト操作" - convert: "変換" - list: "リスト" - blocks: - text: "テキスト" - multiLineText: "テキスト(複数行)" - textList: "テキストのリスト" - _textList: - info: "ひとつひとつを改行で区切ってください" - strLen: "テキストの長さ" - _strLen: - arg1: "テキスト" - strPick: "文字取り出し" - _strPick: - arg1: "テキスト" - arg2: "文字の位置" - strReplace: "テキスト置き換え" - _strReplace: - arg1: "テキスト" - arg2: "置き換え前" - arg3: "置き換え後" - strReverse: "テキストを反転" - _strReverse: - arg1: "テキスト" - join: "テキストを連結" - _join: - arg1: "リスト" - arg2: "区切り" - add: "足す" - _add: - arg1: "A" - arg2: "B" - subtract: "引く" - _subtract: - arg1: "A" - arg2: "B" - multiply: "掛ける" - _multiply: - arg1: "A" - arg2: "B" - divide: "割る" - _divide: - arg1: "A" - arg2: "B" - mod: "割った余り" - _mod: - arg1: "A" - arg2: "B" - round: "小数を丸める" - _round: - arg1: "数値" - eq: "AとBが同じ" - _eq: - arg1: "A" - arg2: "B" - notEq: "AとBが異なる" - _notEq: - arg1: "A" - arg2: "B" - and: "AかつB" - _and: - arg1: "A" - arg2: "B" - or: "AまたはB" - _or: - arg1: "A" - arg2: "B" - lt: "< AがBより小さい" - _lt: - arg1: "A" - arg2: "B" - gt: "> AがBより大きい" - _gt: - arg1: "A" - arg2: "B" - ltEq: "<= AがBと同じか小さい" - _ltEq: - arg1: "A" - arg2: "B" - gtEq: ">= AがBと同じか大きい" - _gtEq: - arg1: "A" - arg2: "B" - if: "分岐" - _if: - arg1: "もし" - arg2: "なら" - arg3: "そうでなければ" - not: "否定" - _not: - arg1: "否定" - random: "ランダム" - _random: - arg1: "確率" - rannum: "乱数" - _rannum: - arg1: "最小" - arg2: "最大" - randomPick: "リストからランダムに選択" - _randomPick: - arg1: "リスト" - dailyRandom: "ランダム (ユーザーごとに日替わり)" - _dailyRandom: - arg1: "確率" - dailyRannum: "乱数 (ユーザーごとに日替わり)" - _dailyRannum: - arg1: "最小" - arg2: "最大" - dailyRandomPick: "リストからランダムに選択 (ユーザーごとに日替わり)" - _dailyRandomPick: - arg1: "リスト" - seedRandom: "ランダム (シード)" - _seedRandom: - arg1: "シード" - arg2: "確率" - seedRannum: "乱数 (シード)" - _seedRannum: - arg1: "シード" - arg2: "最小" - arg3: "最大" - seedRandomPick: "リストからランダムに選択 (シード)" - _seedRandomPick: - arg1: "シード" - arg2: "リスト" - DRPWPM: "確率付きリストからランダムに選択 (ユーザーごとに日替わり)" - _DRPWPM: - arg1: "テキストのリスト" - pick: "リストから選択" - _pick: - arg1: "リスト" - arg2: "位置" - listLen: "リストの長さを取得" - _listLen: - arg1: "リスト" - number: "数値" - stringToNumber: "テキストを数値に" - _stringToNumber: - arg1: "テキスト" - numberToString: "数値をテキストに" - _numberToString: - arg1: "数値" - splitStrByLine: "テキストを行で分割" - _splitStrByLine: - arg1: "テキスト" - ref: "変数" - aiScriptVar: "AiScript変数" - fn: "関数" - _fn: - slots: "スロット" - slots-info: "スロットひとつひとつを改行で区切ってください" - arg1: "出力" - for: "繰り返し" - _for: - arg1: "回数" - arg2: "処理" - typeError: "スロット{slot}は\"{expect}\"を受け付けますが、\"{actual}\"が入れられています!" - thereIsEmptySlot: "スロット{slot}が空です!" - types: - string: "テキスト" - number: "数値" - boolean: "フラグ" - array: "リスト" - stringArray: "テキストのリスト" - emptySlot: "空のスロット" - enviromentVariables: "環境変数" - pageVariables: "ページ要素" - argVariables: "入力スロット" - _relayStatus: requesting: "承認待ち" accepted: "承認済み" diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.button.vue b/packages/client/src/pages/page-editor/els/page-editor.el.button.vue deleted file mode 100644 index 08f993c426..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.button.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.canvas.vue b/packages/client/src/pages/page-editor/els/page-editor.el.canvas.vue deleted file mode 100644 index 7ebf8c1478..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.canvas.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.counter.vue b/packages/client/src/pages/page-editor/els/page-editor.el.counter.vue deleted file mode 100644 index 994d0b5b00..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.counter.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.if.vue b/packages/client/src/pages/page-editor/els/page-editor.el.if.vue deleted file mode 100644 index f56c8aec8a..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.if.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.image.vue b/packages/client/src/pages/page-editor/els/page-editor.el.image.vue index 4b3c6cbf10..a84cb1e80e 100644 --- a/packages/client/src/pages/page-editor/els/page-editor.el.image.vue +++ b/packages/client/src/pages/page-editor/els/page-editor.el.image.vue @@ -21,29 +21,32 @@ import XContainer from '../page-editor.container.vue'; import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; import * as os from '@/os'; -const props = withDefaults(defineProps<{ - value: any -}>(), { - value: { - fileId: null, - }, -}); +const props = defineProps<{ + modelValue: any +}>(); + +const emit = defineEmits<{ + (ev: 'update:modelValue', value: any): void; +}>(); let file: any = $ref(null); async function choose() { os.selectDriveFile(false).then((fileResponse: any) => { file = fileResponse; - props.value.fileId = fileResponse.id; + emit('update:modelValue', { + ...props.modelValue, + fileId: fileResponse.id, + }); }); } onMounted(async () => { - if (props.value.fileId == null) { + if (props.modelValue.fileId == null) { await choose(); } else { os.api('drive/files/show', { - fileId: props.value.fileId, + fileId: props.modelValue.fileId, }).then(fileResponse => { file = fileResponse; }); diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.note.vue b/packages/client/src/pages/page-editor/els/page-editor.el.note.vue index c3b3e3b37e..dcc1a32636 100644 --- a/packages/client/src/pages/page-editor/els/page-editor.el.note.vue +++ b/packages/client/src/pages/page-editor/els/page-editor.el.note.vue @@ -8,10 +8,10 @@ - {{ $ts._pages.blocks._note.detailed }} + {{ $ts._pages.blocks._note.detailed }} - - + + @@ -26,26 +26,31 @@ import XNote from '@/components/MkNote.vue'; import XNoteDetailed from '@/components/MkNoteDetailed.vue'; import * as os from '@/os'; -const props = withDefaults(defineProps<{ - value: any -}>(), { - value: { - note: null, - detailed: false, - }, -}); +const props = defineProps<{ + modelValue: any +}>(); -let id: any = $ref(props.value.note); +const emit = defineEmits<{ + (ev: 'update:modelValue', value: any): void; +}>(); + +let id: any = $ref(props.modelValue.note); let note: any = $ref(null); watch(id, async () => { if (id && (id.startsWith('http://') || id.startsWith('https://'))) { - props.value.note = (id.endsWith('/') ? id.slice(0, -1) : id).split('/').pop(); + emit('update:modelValue', { + ...props.modelValue, + note: (id.endsWith('/') ? id.slice(0, -1) : id).split('/').pop(), + }); } else { - props.value.note = id; + emit('update:modelValue', { + ...props.modelValue, + note: id, + }); } - note = await os.api('notes/show', { noteId: props.value.note }); + note = await os.api('notes/show', { noteId: props.modelValue.note }); }, { immediate: true, }); diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.number-input.vue b/packages/client/src/pages/page-editor/els/page-editor.el.number-input.vue deleted file mode 100644 index dc89d0287b..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.number-input.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.post.vue b/packages/client/src/pages/page-editor/els/page-editor.el.post.vue deleted file mode 100644 index 9592d36829..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.post.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.radio-button.vue b/packages/client/src/pages/page-editor/els/page-editor.el.radio-button.vue deleted file mode 100644 index 1aa2f5ca4b..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.radio-button.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.section.vue b/packages/client/src/pages/page-editor/els/page-editor.el.section.vue index f18188ce61..fd1d3fa69c 100644 --- a/packages/client/src/pages/page-editor/els/page-editor.el.section.vue +++ b/packages/client/src/pages/page-editor/els/page-editor.el.section.vue @@ -1,40 +1,51 @@ - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.text-input.vue b/packages/client/src/pages/page-editor/els/page-editor.el.text-input.vue deleted file mode 100644 index 8cbae1caf5..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.text-input.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.text.vue b/packages/client/src/pages/page-editor/els/page-editor.el.text.vue index 27274253b4..6f11e2a08b 100644 --- a/packages/client/src/pages/page-editor/els/page-editor.el.text.vue +++ b/packages/client/src/pages/page-editor/els/page-editor.el.text.vue @@ -4,22 +4,31 @@
- +
diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.textarea-input.vue b/packages/client/src/pages/page-editor/els/page-editor.el.textarea-input.vue deleted file mode 100644 index 973f32242b..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.textarea-input.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/packages/client/src/pages/page-editor/els/page-editor.el.textarea.vue b/packages/client/src/pages/page-editor/els/page-editor.el.textarea.vue deleted file mode 100644 index e0c05df911..0000000000 --- a/packages/client/src/pages/page-editor/els/page-editor.el.textarea.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/packages/client/src/pages/page-editor/page-editor.blocks.vue b/packages/client/src/pages/page-editor/page-editor.blocks.vue index bc983cd2c8..f99fcb202f 100644 --- a/packages/client/src/pages/page-editor/page-editor.blocks.vue +++ b/packages/client/src/pages/page-editor/page-editor.blocks.vue @@ -1,7 +1,10 @@ @@ -10,25 +13,15 @@ import { defineComponent, defineAsyncComponent } from 'vue'; import XSection from './els/page-editor.el.section.vue'; import XText from './els/page-editor.el.text.vue'; -import XTextarea from './els/page-editor.el.textarea.vue'; import XImage from './els/page-editor.el.image.vue'; -import XButton from './els/page-editor.el.button.vue'; -import XTextInput from './els/page-editor.el.text-input.vue'; -import XTextareaInput from './els/page-editor.el.textarea-input.vue'; -import XNumberInput from './els/page-editor.el.number-input.vue'; -import XSwitch from './els/page-editor.el.switch.vue'; -import XIf from './els/page-editor.el.if.vue'; -import XPost from './els/page-editor.el.post.vue'; -import XCounter from './els/page-editor.el.counter.vue'; -import XRadioButton from './els/page-editor.el.radio-button.vue'; -import XCanvas from './els/page-editor.el.canvas.vue'; import XNote from './els/page-editor.el.note.vue'; import * as os from '@/os'; +import { deepClone } from '@/scripts/clone'; export default defineComponent({ components: { Sortable: defineAsyncComponent(() => import('vuedraggable').then(x => x.default)), - XSection, XText, XImage, XButton, XTextarea, XTextInput, XTextareaInput, XNumberInput, XSwitch, XIf, XPost, XCounter, XRadioButton, XCanvas, XNote, + XSection, XText, XImage, XNote, }, props: { @@ -36,43 +29,37 @@ export default defineComponent({ type: Array, required: true, }, - hpml: { - required: true, - }, }, emits: ['update:modelValue'], - computed: { - blocks: { - get() { - return this.modelValue; - }, - set(value) { - this.$emit('update:modelValue', value); - }, - }, - }, - methods: { updateItem(v) { - const i = this.blocks.findIndex(x => x.id === v.id); + const i = this.modelValue.findIndex(x => x.id === v.id); const newValue = [ - ...this.blocks.slice(0, i), + ...this.modelValue.slice(0, i), v, - ...this.blocks.slice(i + 1), + ...this.modelValue.slice(i + 1), ]; this.$emit('update:modelValue', newValue); }, removeItem(el) { - const i = this.blocks.findIndex(x => x.id === el.id); + const i = this.modelValue.findIndex(x => x.id === el.id); const newValue = [ - ...this.blocks.slice(0, i), - ...this.blocks.slice(i + 1), + ...this.modelValue.slice(0, i), + ...this.modelValue.slice(i + 1), ]; this.$emit('update:modelValue', newValue); }, }, }); + + diff --git a/packages/client/src/pages/page-editor/page-editor.container.vue b/packages/client/src/pages/page-editor/page-editor.container.vue index 03228b8e01..15cdda5efb 100644 --- a/packages/client/src/pages/page-editor/page-editor.container.vue +++ b/packages/client/src/pages/page-editor/page-editor.container.vue @@ -74,7 +74,7 @@ export default defineComponent({ overflow: hidden; background: var(--panel); border: solid 2px var(--X12); - border-radius: 6px; + border-radius: 8px; &:hover { border: solid 2px var(--X13); @@ -88,10 +88,6 @@ export default defineComponent({ border: solid 2px #f00; } - & + .cpjygsrt { - margin-top: 16px; - } - > header { > .title { z-index: 1; diff --git a/packages/client/src/pages/page-editor/page-editor.script-block.vue b/packages/client/src/pages/page-editor/page-editor.script-block.vue deleted file mode 100644 index 1f621e185f..0000000000 --- a/packages/client/src/pages/page-editor/page-editor.script-block.vue +++ /dev/null @@ -1,279 +0,0 @@ - - - - - diff --git a/packages/client/src/pages/page-editor/page-editor.vue b/packages/client/src/pages/page-editor/page-editor.vue index f094de0cbc..f7740545d1 100644 --- a/packages/client/src/pages/page-editor/page-editor.vue +++ b/packages/client/src/pages/page-editor/page-editor.vue @@ -45,36 +45,10 @@
-
- +
+ - -
-
- -
-
- - - - - -
-
- -
-
- +
@@ -83,31 +57,20 @@ + +