Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default [
...recommended,
eslintPluginPrettierRecommended,
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@stylistic/exp-list-style': 'off',
},
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"dev:watch": "NODE_OPTIONS='--max-old-space-size=4096' npx vite --mode development build --watch",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .js,.vue src",
"lint:fix": "eslint --ext .js,.vue src --fix",
"lint": "eslint --ext .js,.ts,.vue src",
"lint:fix": "eslint --ext .js,.ts,.vue src --fix",
"start:nextcloud": "node playwright/start-nextcloud-server.mjs",
"stylelint": "stylelint css/*.css css/*.scss src/**/*.vue",
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.vue --fix"
Expand Down Expand Up @@ -57,6 +57,7 @@
"@nextcloud/stylelint-config": "^3.2.2",
"@nextcloud/vite-config": "^2.5.2",
"@playwright/test": "^1.61.1",
"@types/node": "^25.6.1",
"@vue/tsconfig": "^0.9.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6",
Expand Down
6 changes: 3 additions & 3 deletions src/Forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ import AppNavigationForm from './components/AppNavigationForm.vue'
import ArchivedFormsModal from './components/ArchivedFormsModal.vue'
import Sidebar from './views/Sidebar.vue'
import FormsIcon from '../img/forms-dark.svg?raw'
import PermissionTypes from './mixins/PermissionTypes.js'
import PermissionTypes from './mixins/PermissionTypes.ts'
import { FormState } from './models/Constants.ts'
import logger from './utils/Logger.js'
import OcsResponse2Data from './utils/OcsResponse2Data.js'
import logger from './utils/Logger.ts'
import OcsResponse2Data from './utils/OcsResponse2Data.ts'

const appName = 'forms'

Expand Down
2 changes: 1 addition & 1 deletion src/FormsSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ import NcInputField from '@nextcloud/vue/components/NcInputField'
import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
import NcSelect from '@nextcloud/vue/components/NcSelect'
import NcSettingsSection from '@nextcloud/vue/components/NcSettingsSection'
import logger from './utils/Logger.js'
import logger from './utils/Logger.ts'

export default {
name: 'FormsSettings',
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppNavigationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import FormsIcon from '../../img/forms-dark.svg?raw'
import PermissionTypes from '../mixins/PermissionTypes.js'
import PermissionTypes from '../mixins/PermissionTypes.ts'
import { FormState } from '../models/Constants.ts'
import logger from '../utils/Logger.js'
import logger from '../utils/Logger.ts'

export default {
name: 'AppNavigationForm',
Expand Down
2 changes: 1 addition & 1 deletion src/components/PaginationToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default {
}

.selected-page {
padding-left: 5px;
padding-inline-start: 5px;

display: inline-flex;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion src/components/QRDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<script>
import QRCode from 'qrcode'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import logger from '../utils/Logger.js'
import logger from '../utils/Logger.ts'

export default {
name: 'QRDialog',
Expand Down
4 changes: 2 additions & 2 deletions src/components/Questions/AnswerInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ import NcActions from '@nextcloud/vue/components/NcActions'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import { INPUT_DEBOUNCE_MS, OptionType } from '../../models/Constants.ts'
import logger from '../../utils/Logger.js'
import OcsResponse2Data from '../../utils/OcsResponse2Data.js'
import logger from '../../utils/Logger.ts'
import OcsResponse2Data from '../../utils/OcsResponse2Data.ts'

export default {
name: 'AnswerInput',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionColor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import NcButton from '@nextcloud/vue/components/NcButton'
import NcColorPicker from '@nextcloud/vue/components/NcColorPicker'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'

export default {
name: 'QuestionColor',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionDate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ import svgClockLoader20 from '../../../img/clock_loader_20.svg?raw'
import svgClockLoader80 from '../../../img/clock_loader_80.svg?raw'
import svgEventIcon from '../../../img/event.svg?raw'
import svgTodayIcon from '../../../img/today.svg?raw'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'

export default {
name: 'QuestionDate',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<AnswerInput
v-for="(answer, index) in choices"
:key="answer.local ? 'option-local' : answer.id"
ref="input"

Check warning on line 72 in src/components/Questions/QuestionDropdown.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'input' is defined as ref, but never used
:answer="answer"
:formId="formId"
isDropdown
Expand Down Expand Up @@ -110,7 +110,7 @@
import OptionInputDialog from '../OptionInputDialog.vue'
import AnswerInput from './AnswerInput.vue'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import QuestionMultipleMixin from '../../mixins/QuestionMultipleMixin.ts'
import { OptionType } from '../../models/Constants.ts'

Expand Down Expand Up @@ -170,7 +170,7 @@
}

const selected = this.values.map((id) =>
this.options.find((option) => option.id === parseInt(id)),

Check failure on line 173 in src/components/Questions/QuestionDropdown.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Should not have line break(s) between ',' and ')'
)

return this.isMultiple ? selected : selected[0]
Expand Down
8 changes: 4 additions & 4 deletions src/components/Questions/QuestionFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import NcListItem from '@nextcloud/vue/components/NcListItem'
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import fileTypes from '../../models/FileTypes.js'
import logger from '../../utils/Logger.js'
import OcsResponse2Data from '../../utils/OcsResponse2Data.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import fileTypes from '../../models/FileTypes.ts'
import logger from '../../utils/Logger.ts'
import OcsResponse2Data from '../../utils/OcsResponse2Data.ts'

/**
* A constant object representing file size units in bytes.
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<AnswerInput
v-for="(answer, index) in columns"
:key="answer.local ? 'option-local' : answer.id"
ref="input"

Check warning on line 115 in src/components/Questions/QuestionGrid.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'input' is defined as ref, but never used
:answer="answer"
:formId="formId"
:index="index"
Expand Down Expand Up @@ -150,7 +150,7 @@
<AnswerInput
v-for="(answer, index) in rows"
:key="answer.local ? 'option-local' : answer.id"
ref="input"

Check warning on line 153 in src/components/Questions/QuestionGrid.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'input' is defined as ref, but never used
:answer="answer"
:formId="formId"
:index="index"
Expand Down Expand Up @@ -183,7 +183,7 @@
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import AnswerInput from './AnswerInput.vue'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import QuestionMultipleMixin from '../../mixins/QuestionMultipleMixin.ts'
import { GridCellType, OptionType } from '../../models/Constants.ts'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionLinearScale.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwit
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import NcTextArea from '@nextcloud/vue/components/NcTextArea'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'

export default {
name: 'QuestionLinearScale',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionLong.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<script>
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'

export default {
name: 'QuestionLong',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionMultiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<AnswerInput
v-for="(answer, index) in choices"
:key="answer.local ? 'option-local' : answer.id"
ref="input"

Check warning on line 141 in src/components/Questions/QuestionMultiple.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'input' is defined as ref, but never used
:answer="answer"
:formId="formId"
:index="index"
Expand Down Expand Up @@ -201,7 +201,7 @@
import OptionInputDialog from '../OptionInputDialog.vue'
import AnswerInput from './AnswerInput.vue'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import QuestionMultipleMixin from '../../mixins/QuestionMultipleMixin.ts'
import {
OptionType,
Expand Down Expand Up @@ -286,7 +286,7 @@
*/
otherAnswer() {
return this.values.find((v) =>
v.startsWith(QUESTION_EXTRASETTINGS_OTHER_PREFIX),

Check failure on line 289 in src/components/Questions/QuestionMultiple.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Should not have line break(s) between ',' and ')'
)
},

Expand Down
2 changes: 1 addition & 1 deletion src/components/Questions/QuestionRanking.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
import OptionInputDialog from '../OptionInputDialog.vue'
import AnswerInput from './AnswerInput.vue'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import QuestionMultipleMixin from '../../mixins/QuestionMultipleMixin.ts'
import { OptionType } from '../../models/Constants.ts'

Expand Down
6 changes: 3 additions & 3 deletions src/components/Questions/QuestionShort.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ import NcActionRadio from '@nextcloud/vue/components/NcActionRadio'
import NcActions from '@nextcloud/vue/components/NcActions'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import Question from './Question.vue'
import QuestionMixin from '../../mixins/QuestionMixin.js'
import QuestionMixin from '../../mixins/QuestionMixin.ts'
import { INPUT_DEBOUNCE_MS } from '../../models/Constants.ts'
import validationTypes from '../../models/ValidationTypes.js'
import { splitRegex, validateExpression } from '../../utils/RegularExpression.js'
import validationTypes from '../../models/ValidationTypes.ts'
import { splitRegex, validateExpression } from '../../utils/RegularExpression.ts'

export default {
name: 'QuestionShort',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Results/ResultsSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
import IconFile from '@material-symbols/svg-400/outlined/draft.svg?raw'
import { generateUrl } from '@nextcloud/router'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import answerTypes from '../../models/AnswerTypes.js'
import answerTypes from '../../models/AnswerTypes.ts'
import { GridCellType, OptionType } from '../../models/Constants.ts'

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SidebarTabs/SettingsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ import NcSelect from '@nextcloud/vue/components/NcSelect'
import NcTextArea from '@nextcloud/vue/components/NcTextArea'
import TransferOwnership from './TransferOwnership.vue'
import svgLockOpen from '../../../img/lock_open.svg?raw'
import ShareTypes from '../../mixins/ShareTypes.js'
import ShareTypes from '../../mixins/ShareTypes.ts'
import { FormState } from '../../models/Constants.ts'

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SidebarTabs/SharingSearchDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<script>
import NcSelectUsers from '@nextcloud/vue/components/NcSelectUsers'
import UserSearchMixin from '../../mixins/UserSearchMixin.js'
import UserSearchMixin from '../../mixins/UserSearchMixin.ts'

export default {
components: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SidebarTabs/SharingShareDiv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import NcActions from '@nextcloud/vue/components/NcActions'
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import PermissionTypes from '../../mixins/PermissionTypes.js'
import ShareTypes from '../../mixins/ShareTypes.js'
import PermissionTypes from '../../mixins/PermissionTypes.ts'
import ShareTypes from '../../mixins/ShareTypes.ts'

export default {
components: {
Expand Down
10 changes: 5 additions & 5 deletions src/components/SidebarTabs/SharingSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@
import SharingSearchDiv from './SharingSearchDiv.vue'
import SharingShareDiv from './SharingShareDiv.vue'
import FormsIcon from '../../../img/forms-dark.svg?raw'
import PermissionTypes from '../../mixins/PermissionTypes.js'
import ShareLinkMixin from '../../mixins/ShareLinkMixin.js'
import ShareTypes from '../../mixins/ShareTypes.js'
import PermissionTypes from '../../mixins/PermissionTypes.ts'
import ShareLinkMixin from '../../mixins/ShareLinkMixin.ts'
import ShareTypes from '../../mixins/ShareTypes.ts'
import { INPUT_DEBOUNCE_MS } from '../../models/Constants.ts'
import logger from '../../utils/Logger.js'
import OcsResponse2Data from '../../utils/OcsResponse2Data.js'
import logger from '../../utils/Logger.ts'
import OcsResponse2Data from '../../utils/OcsResponse2Data.ts'

export default {
components: {
Expand Down Expand Up @@ -356,7 +356,7 @@
(share) => share.shareType === this.SHARE_TYPES.SHARE_TYPE_LINK,
)
shares.sort((a, b) =>
this.isEmbeddingAllowed(a) ? 1 : this.isEmbeddingAllowed(b) ? -1 : 0,

Check failure on line 359 in src/components/SidebarTabs/SharingSidebarTab.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Should not have line break(s) between ',' and ')'
)
return shares
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/SidebarTabs/TransferOwnership.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ import NcButton from '@nextcloud/vue/components/NcButton'
import NcDialog from '@nextcloud/vue/components/NcDialog'
import NcSelectUsers from '@nextcloud/vue/components/NcSelectUsers'
import NcTextField from '@nextcloud/vue/components/NcTextField'
import UserSearchMixin from '../../mixins/UserSearchMixin.js'
import logger from '../../utils/Logger.js'
import UserSearchMixin from '../../mixins/UserSearchMixin.ts'
import logger from '../../utils/Logger.ts'

export default {
components: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import { useIsMobile } from '@nextcloud/vue'
import NcButton from '@nextcloud/vue/components/NcButton'
import NcIconSvgWrapper from '@nextcloud/vue/components/NcIconSvgWrapper'
import PillMenu from './PillMenu.vue'
import PermissionTypes from '../mixins/PermissionTypes.js'
import logger from '../utils/Logger.js'
import PermissionTypes from '../mixins/PermissionTypes.ts'
import logger from '../utils/Logger.ts'

const submitView = {
ariaLabel: t('forms', 'View form'),
Expand Down
2 changes: 2 additions & 0 deletions src/emptyContent.js → src/emptyContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ const app = createApp(FormsEmptyContent)
app.config.globalProperties.t = translate
app.config.globalProperties.n = translatePlural
app.mount('#content')

export default app
2 changes: 1 addition & 1 deletion src/main.js → src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { translate, translatePlural } from '@nextcloud/l10n'
import { createApp } from 'vue'
import Forms from './Forms.vue'
import router from './router.js'
import router from './router.ts'

import 'vite/modulepreload-polyfill'
import '@nextcloud/dialogs/style.css'
Expand Down
28 changes: 0 additions & 28 deletions src/mixins/PermissionTypes.js

This file was deleted.

48 changes: 48 additions & 0 deletions src/mixins/PermissionTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { defineComponent } from 'vue'

// !!! Keep in Sync with lib/Constants.php !!!
export const PERMISSION_EDIT = 'edit'
export const PERMISSION_RESULTS = 'results'
export const PERMISSION_RESULTS_DELETE = 'results_delete'
export const PERMISSION_SUBMIT = 'submit'
/** Internal permission to mark public link shares as embeddable */
export const PERMISSION_EMBED = 'embed'
export const PERMISSION_ALL = [
PERMISSION_EDIT,
PERMISSION_RESULTS,
PERMISSION_RESULTS_DELETE,
PERMISSION_SUBMIT,
]

export interface PermissionTypesData {
PERMISSION_TYPES: {
PERMISSION_EDIT: string
PERMISSION_RESULTS: string
PERMISSION_RESULTS_DELETE: string
PERMISSION_SUBMIT: string
PERMISSION_EMBED: string
PERMISSION_ALL: string[]
}
}

export default defineComponent({
name: 'PermissionTypes',

data(): PermissionTypesData {
return {
PERMISSION_TYPES: {
PERMISSION_EDIT,
PERMISSION_RESULTS,
PERMISSION_RESULTS_DELETE,
PERMISSION_SUBMIT,
PERMISSION_EMBED,
PERMISSION_ALL,
},
}
},
})
Loading
Loading