Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <mc.sanaei@gmail.com>2023-02-09 22:18:06 +0300
committerMHSanaei <mc.sanaei@gmail.com>2023-02-09 22:18:06 +0300
commitb73e4173a3c1e69e02ad6b4e3b43e425e57a5be9 (patch)
treed95d2f5e903d97082e11eb9f9023c165b1bde388 /web/html/common/prompt_modal.html
3x-ui
Diffstat (limited to 'web/html/common/prompt_modal.html')
-rw-r--r--web/html/common/prompt_modal.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/web/html/common/prompt_modal.html b/web/html/common/prompt_modal.html
new file mode 100644
index 00000000..91c26615
--- /dev/null
+++ b/web/html/common/prompt_modal.html
@@ -0,0 +1,67 @@
+{{define "promptModal"}}
+<a-modal id="prompt-modal" v-model="promptModal.visible" :title="promptModal.title"
+ :closable="true" @ok="promptModal.ok" :mask-closable="false"
+ :ok-text="promptModal.okText" cancel-text='{{ i18n "cancel" }}'>
+ <a-input id="prompt-modal-input" :type="promptModal.type"
+ v-model="promptModal.value"
+ :autosize="{minRows: 10, maxRows: 20}"
+ @keydown.enter.native="promptModal.keyEnter"
+ @keydown.ctrl.83="promptModal.ctrlS"></a-input>
+</a-modal>
+
+<script>
+
+ const promptModal = {
+ title: '',
+ type: '',
+ value: '',
+ okText: '{{ i18n "sure"}}',
+ visible: false,
+ keyEnter(e) {
+ if (this.type !== 'textarea') {
+ e.preventDefault();
+ this.ok();
+ }
+ },
+ ctrlS(e) {
+ if (this.type === 'textarea') {
+ e.preventDefault();
+ promptModal.confirm(promptModal.value);
+ }
+ },
+ ok() {
+ promptModal.close();
+ promptModal.confirm(promptModal.value);
+ },
+ confirm() {},
+ open({
+ title='',
+ type='text',
+ value='',
+ okText='{{ i18n "sure"}}',
+ confirm=() => {},
+ }) {
+ this.title = title;
+ this.type = type;
+ this.value = value;
+ this.okText = okText;
+ this.confirm = confirm;
+ this.visible = true;
+ promptModalApp.$nextTick(() => {
+ document.querySelector('#prompt-modal-input').focus();
+ });
+ },
+ close() {
+ this.visible = false;
+ }
+ };
+
+ const promptModalApp = new Vue({
+ el: '#prompt-modal',
+ data: {
+ promptModal: promptModal,
+ },
+ });
+
+</script>
+{{end}} \ No newline at end of file