Playground.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719
  1. <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <!-- eslint-disable zammad/zammad-detect-translatable-string -->
  3. <script setup lang="ts">
  4. import { reset } from '@formkit/core'
  5. import gql from 'graphql-tag'
  6. import { storeToRefs } from 'pinia'
  7. import {
  8. computed,
  9. h,
  10. onMounted,
  11. reactive,
  12. ref,
  13. watch,
  14. type Ref,
  15. useTemplateRef,
  16. } from 'vue'
  17. import CommonAlert from '#shared/components/CommonAlert/CommonAlert.vue'
  18. import CommonPopover from '#shared/components/CommonPopover/CommonPopover.vue'
  19. import type {
  20. Orientation,
  21. Placement,
  22. } from '#shared/components/CommonPopover/types.ts'
  23. import { usePopover } from '#shared/components/CommonPopover/usePopover.ts'
  24. import CommonTranslateRenderer from '#shared/components/CommonTranslateRenderer/CommonTranslateRenderer.vue'
  25. import CommonUserAvatar from '#shared/components/CommonUserAvatar/CommonUserAvatar.vue'
  26. import Form from '#shared/components/Form/Form.vue'
  27. import type {
  28. FormSchemaNode,
  29. FormValues,
  30. } from '#shared/components/Form/types.ts'
  31. import { useConfirmation } from '#shared/composables/useConfirmation.ts'
  32. import { useCopyToClipboard } from '#shared/composables/useCopyToClipboard.ts'
  33. import { defineFormSchema } from '#shared/form/defineFormSchema.ts'
  34. import { EnumObjectManagerObjects } from '#shared/graphql/types.ts'
  35. import { useApplicationStore } from '#shared/stores/application.ts'
  36. import { useSessionStore } from '#shared/stores/session.ts'
  37. import CommonActionMenu from '#desktop/components/CommonActionMenu/CommonActionMenu.vue'
  38. import CommonBreadcrumb from '#desktop/components/CommonBreadcrumb/CommonBreadcrumb.vue'
  39. import CommonButton from '#desktop/components/CommonButton/CommonButton.vue'
  40. import CommonButtonGroup from '#desktop/components/CommonButtonGroup/CommonButtonGroup.vue'
  41. import type { CommonButtonItem } from '#desktop/components/CommonButtonGroup/types.ts'
  42. import CommonDialog from '#desktop/components/CommonDialog/CommonDialog.vue'
  43. import { useDialog } from '#desktop/components/CommonDialog/useDialog.ts'
  44. import CommonFlyout from '#desktop/components/CommonFlyout/CommonFlyout.vue'
  45. import { useFlyout } from '#desktop/components/CommonFlyout/useFlyout.ts'
  46. import CommonInlineEdit from '#desktop/components/CommonInlineEdit/CommonInlineEdit.vue'
  47. import CommonInputCopyToClipboard from '#desktop/components/CommonInputCopyToClipboard/CommonInputCopyToClipboard.vue'
  48. import CommonPopoverMenu from '#desktop/components/CommonPopoverMenu/CommonPopoverMenu.vue'
  49. import type { MenuItem } from '#desktop/components/CommonPopoverMenu/types.ts'
  50. import CommonProgressBar from '#desktop/components/CommonProgressBar/CommonProgressBar.vue'
  51. import CommonSimpleTable from '#desktop/components/CommonSimpleTable/CommonSimpleTable.vue'
  52. import CommonTabManager from '#desktop/components/CommonTabManager/CommonTabManager.vue'
  53. import { useTabManager } from '#desktop/components/CommonTabManager/useTabManager.ts'
  54. import LayoutContent from '#desktop/components/layout/LayoutContent.vue'
  55. import ThemeSwitch from '#desktop/components/ThemeSwitch/ThemeSwitch.vue'
  56. const alphabetOptions = computed(() =>
  57. [...Array(26).keys()].map((i) => ({
  58. value: i,
  59. label: `Item ${String.fromCharCode(65 + i)}`,
  60. disabled: Math.random() < 0.5,
  61. })),
  62. )
  63. const { copyToClipboard } = useCopyToClipboard()
  64. const longOption = ref({
  65. value: 999,
  66. label:
  67. 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, nullam pulvinar nunc sapien, vitae malesuada justo interdum feugiat, mauris odio, mattis et malesuada quis, vulputate vitae enim',
  68. })
  69. const permissions = [
  70. {
  71. value: 'admin',
  72. label: 'Admin interface',
  73. description: 'To configure your system.',
  74. children: [
  75. {
  76. value: 'admin.user',
  77. label: 'Users',
  78. description: 'To manage all users of your system.',
  79. },
  80. {
  81. value: 'admin.group',
  82. label: 'Groups',
  83. description: 'To manage groups of your system.',
  84. },
  85. {
  86. value: 'admin.role',
  87. label: 'Roles',
  88. description: 'To manage roles of your system.',
  89. },
  90. {
  91. value: 'admin.organization',
  92. label: 'Organizations',
  93. description: 'To manage all organizations of your system.',
  94. },
  95. {
  96. value: 'admin.overview',
  97. label: 'Overviews',
  98. description: 'To manage ticket overviews of your system.',
  99. },
  100. {
  101. value: 'admin.text_module',
  102. label: 'Text modules',
  103. description: 'To manage text modules of your system.',
  104. },
  105. {
  106. value: 'admin.macro',
  107. label: 'Macros',
  108. description: 'To manage ticket macros of your system.',
  109. },
  110. {
  111. value: 'admin.template',
  112. label: 'Templates',
  113. description: 'To manage ticket templates of your system.',
  114. },
  115. {
  116. value: 'admin.tag',
  117. label: 'Tags',
  118. description: 'To manage ticket tags of your system.',
  119. },
  120. {
  121. value: 'admin.calendar',
  122. label: 'Calendar',
  123. description: 'To manage calendars of your system.',
  124. },
  125. {
  126. value: 'admin.sla',
  127. label: 'SLAs',
  128. description: 'To manage Service Level Agreements of your system.',
  129. },
  130. {
  131. value: 'admin.trigger',
  132. label: 'Trigger',
  133. description: 'To manage triggers of your system.',
  134. },
  135. {
  136. value: 'admin.public_links',
  137. label: 'Public Links',
  138. description: 'To manage public links of your system.',
  139. },
  140. {
  141. value: 'admin.webhook',
  142. label: 'Webhook',
  143. description: 'To manage webhooks of your system.',
  144. },
  145. {
  146. value: 'admin.scheduler',
  147. label: 'Scheduler',
  148. description: 'To manage schedulers of your system.',
  149. },
  150. {
  151. value: 'admin.report_profile',
  152. label: 'Report Profiles',
  153. description: 'To manage report profiles of your system.',
  154. },
  155. {
  156. value: 'admin.time_accounting',
  157. label: 'Time Accounting',
  158. description: 'To manage time accounting settings of your system.',
  159. },
  160. {
  161. value: 'admin.knowledge_base',
  162. label: 'Knowledge Base',
  163. description: 'To create and set up Knowledge Base.',
  164. },
  165. {
  166. value: 'admin.channel_web',
  167. label: 'Web',
  168. description: 'To manage web channel of your system.',
  169. },
  170. {
  171. value: 'admin.channel_formular',
  172. label: 'Form',
  173. description: 'To manage form channel of your system.',
  174. },
  175. {
  176. value: 'admin.channel_email',
  177. label: 'Email',
  178. description: 'To manage email channel of your system.',
  179. },
  180. {
  181. value: 'admin.channel_sms',
  182. label: 'SMS',
  183. description: 'To manage SMS channel of your system.',
  184. },
  185. {
  186. value: 'admin.channel_chat',
  187. label: 'Chat',
  188. description: 'To manage chat channel of your system.',
  189. },
  190. {
  191. value: 'admin.channel_google',
  192. label: 'Google',
  193. description: 'To manage Google channel of your system.',
  194. },
  195. {
  196. value: 'admin.channel_microsoft365',
  197. label: ' Microsoft 365',
  198. description: 'To manage Microsoft 365 channel of your system.',
  199. },
  200. {
  201. value: 'admin.channel_twitter',
  202. label: 'Twitter',
  203. description: 'To manage Twitter channel of your system.',
  204. },
  205. {
  206. value: 'admin.channel_facebook',
  207. label: 'Facebook',
  208. description: 'To manage Facebook channel of your system.',
  209. },
  210. {
  211. value: 'admin.channel_telegram',
  212. label: 'Telegram',
  213. description: 'To manage Telegram channel of your system.',
  214. },
  215. {
  216. value: 'admin.channel_whatsapp',
  217. label: 'WhatsApp',
  218. description: 'To manage WhatsApp channel of your system.',
  219. },
  220. {
  221. value: 'admin.branding',
  222. label: 'Branding',
  223. description: 'To manage branding settings of your system.',
  224. },
  225. {
  226. value: 'admin.setting_system',
  227. label: 'System',
  228. description: 'To manage core system settings.',
  229. },
  230. {
  231. value: 'admin.security',
  232. label: 'Security',
  233. description: 'To manage security settings of your system.',
  234. },
  235. {
  236. value: 'admin.ticket',
  237. label: 'Ticket',
  238. description: 'To manage ticket settings of your system.',
  239. },
  240. {
  241. value: 'admin.integration',
  242. label: 'Integrations',
  243. description: 'To manage integrations of your system.',
  244. },
  245. {
  246. value: 'admin.api',
  247. label: 'API',
  248. description: 'To manage API of your system.',
  249. },
  250. {
  251. value: 'admin.object',
  252. label: 'Objects',
  253. description: 'To manage object attributes of your system.',
  254. },
  255. {
  256. value: 'admin.ticket_state',
  257. label: 'Ticket States',
  258. description: 'To manage ticket states of your system.',
  259. },
  260. {
  261. value: 'admin.ticket_priority',
  262. label: 'Ticket Priorities',
  263. description: 'To manage ticket priorities of your system.',
  264. },
  265. {
  266. value: 'admin.core_workflow',
  267. label: 'Core Workflows',
  268. description: 'To manage core workflows of your system.',
  269. },
  270. {
  271. value: 'admin.translation',
  272. label: 'Translations',
  273. description: 'To manage translations of your system.',
  274. },
  275. {
  276. value: 'admin.data_privacy',
  277. label: 'Data Privacy',
  278. description: 'To delete existing data of your system.',
  279. },
  280. {
  281. value: 'admin.maintenance',
  282. label: 'Maintenance',
  283. description: 'To manage maintenance mode of your system.',
  284. },
  285. {
  286. value: 'admin.monitoring',
  287. label: 'Monitoring',
  288. description: 'To manage monitoring of your system.',
  289. },
  290. {
  291. value: 'admin.package',
  292. label: 'Packages',
  293. description: 'To manage packages of your system.',
  294. },
  295. {
  296. value: 'admin.session',
  297. label: 'Sessions',
  298. description: 'To manage active user sessions of your system.',
  299. },
  300. {
  301. value: 'admin.system_report',
  302. label: 'System Report',
  303. description: 'To manage system report of your system.',
  304. },
  305. ],
  306. },
  307. {
  308. value: 'chat',
  309. label: 'Chat',
  310. description: 'To access the chat interface.',
  311. disabled: true,
  312. children: [
  313. {
  314. value: 'chat.agent',
  315. label: 'Agent Chat',
  316. description: 'To access the agent chat features.',
  317. },
  318. ],
  319. },
  320. {
  321. value: 'cti',
  322. label: 'Phone',
  323. description: 'To access the phone interface.',
  324. disabled: true,
  325. children: [
  326. {
  327. value: 'cti.agent',
  328. label: 'Agent Phone',
  329. description: 'To access the agent phone features.',
  330. },
  331. ],
  332. },
  333. {
  334. value: 'knowledge_base',
  335. label: 'Knowledge Base',
  336. description: 'To access the knowledge base interface.',
  337. disabled: true,
  338. children: [
  339. {
  340. value: 'knowledge_base.editor',
  341. label: 'Knowledge Base Editor',
  342. description: 'To access the knowledge base editor features.',
  343. },
  344. {
  345. value: 'knowledge_base.reader',
  346. label: 'Knowledge Base Reader',
  347. description: 'To access the knowledge base reader features.',
  348. },
  349. ],
  350. },
  351. {
  352. value: 'report',
  353. label: 'Report',
  354. description: 'To access the report interface.',
  355. },
  356. {
  357. value: 'ticket',
  358. label: 'Ticket',
  359. description: 'To access the ticket interface.',
  360. disabled: true,
  361. children: [
  362. {
  363. value: 'ticket.agent',
  364. label: 'Agent Tickets',
  365. description: 'To access the agent tickets based on group access.',
  366. },
  367. {
  368. value: 'ticket.customer',
  369. label: 'Customer Tickets',
  370. description: 'To access the customer tickets.',
  371. },
  372. ],
  373. },
  374. {
  375. value: 'user_preferences',
  376. label: 'Profile settings',
  377. description: 'To access the personal settings.',
  378. children: [
  379. {
  380. value: 'user_preferences.appearance',
  381. label: 'Appearance',
  382. description: 'To access the appearance personal setting.',
  383. },
  384. {
  385. value: 'user_preferences.language',
  386. label: 'Language',
  387. description: 'To access the language personal setting.',
  388. },
  389. {
  390. value: 'user_preferences.avatar',
  391. label: 'Avatar',
  392. description: 'To access the avatar personal setting.',
  393. },
  394. {
  395. value: 'user_preferences.out_of_office',
  396. label: 'Out of Office',
  397. description: 'To access the out of office personal setting.',
  398. },
  399. {
  400. value: 'user_preferences.password',
  401. label: 'Password',
  402. description: 'To access the change password personal setting.',
  403. },
  404. {
  405. value: 'user_preferences.two_factor_authentication',
  406. label: 'Two-factor Authentication',
  407. description:
  408. 'To access the two-factor authentication personal setting.',
  409. },
  410. {
  411. value: 'user_preferences.device',
  412. label: 'Devices',
  413. description: 'To access the devices personal setting.',
  414. },
  415. {
  416. value: 'user_preferences.access_token',
  417. label: 'Token Access',
  418. description: 'To access the API token personal setting.',
  419. },
  420. {
  421. value: 'user_preferences.linked_accounts',
  422. label: 'Linked Accounts',
  423. description: 'To access the linked accounts personal setting.',
  424. },
  425. {
  426. value: 'user_preferences.notifications',
  427. label: 'Notifications',
  428. description: 'To access the notifications personal setting.',
  429. },
  430. {
  431. value: 'user_preferences.overview_sorting',
  432. label: 'Overviews',
  433. description: 'To access the overviews personal setting.',
  434. },
  435. {
  436. value: 'user_preferences.calendar',
  437. label: 'Calendar',
  438. description: 'To access the calendar personal setting.',
  439. },
  440. ],
  441. },
  442. ]
  443. const treeselectOptions = [
  444. {
  445. value: 0,
  446. label: 'Item A',
  447. disabled: true,
  448. children: [
  449. {
  450. value: 1,
  451. label: 'Item 1',
  452. children: [
  453. {
  454. value: 2,
  455. label: 'Item I',
  456. },
  457. {
  458. value: 3,
  459. label: 'Item II',
  460. },
  461. {
  462. value: 4,
  463. label: 'Item III',
  464. },
  465. ],
  466. },
  467. {
  468. value: 5,
  469. label: 'Item 2',
  470. children: [
  471. ...[longOption.value],
  472. {
  473. value: 6,
  474. label: 'Item IV',
  475. },
  476. ],
  477. },
  478. {
  479. value: 7,
  480. label: 'Item 3',
  481. },
  482. ],
  483. },
  484. {
  485. value: 8,
  486. label: 'Item B',
  487. },
  488. {
  489. value: 9,
  490. label: 'Ítem C',
  491. },
  492. ]
  493. const buttonGroupOptions: CommonButtonItem[] = [
  494. {
  495. label: 'Button 1',
  496. variant: 'primary',
  497. icon: 'logo-flat',
  498. onActionClick: () => console.debug('Button 1 clicked'),
  499. },
  500. {
  501. label: 'Button 2',
  502. variant: 'secondary',
  503. },
  504. {
  505. label: 'Button 3',
  506. variant: 'tertiary',
  507. },
  508. {
  509. label: 'Button 4',
  510. variant: 'submit',
  511. },
  512. {
  513. label: 'Button 5',
  514. variant: 'danger',
  515. },
  516. {
  517. label: 'Button 6',
  518. variant: 'subtle',
  519. },
  520. {
  521. label: 'Button 7',
  522. variant: 'neutral',
  523. },
  524. ]
  525. const application = useApplicationStore()
  526. const formSchema = defineFormSchema([
  527. {
  528. type: 'editor',
  529. name: 'editor',
  530. label: 'Editor',
  531. required: true,
  532. },
  533. {
  534. isLayout: true,
  535. element: 'div',
  536. attrs: {
  537. class: 'grid md:grid-cols-2 gap-y-2.5 gap-x-3',
  538. },
  539. children: [
  540. {
  541. name: 'select_0',
  542. label: 'Column select',
  543. type: 'select',
  544. outerClass: 'col-span-1',
  545. props: {
  546. maxLength: 150,
  547. options: [...alphabetOptions.value, ...[longOption.value]],
  548. clearable: true,
  549. help: 'Testing',
  550. },
  551. },
  552. {
  553. name: 'toggle_1',
  554. label: 'Column toggle',
  555. type: 'toggle',
  556. outerClass: 'col-span-1',
  557. wrapperClass: 'md:mt-6',
  558. props: {
  559. variants: {
  560. true: 'yes',
  561. false: 'no',
  562. },
  563. },
  564. },
  565. {
  566. name: 'toggle_2',
  567. label: 'Row toggle',
  568. type: 'toggle',
  569. props: {
  570. variants: {
  571. true: 'yes',
  572. false: 'no',
  573. },
  574. },
  575. },
  576. ],
  577. },
  578. {
  579. type: 'security',
  580. name: 'security',
  581. label: 'Security',
  582. props: {
  583. securityAllowed: {
  584. SMIME: [],
  585. PGP: ['sign', 'encryption'],
  586. },
  587. securityDefaultOptions: {
  588. SMIME: ['sign', 'encryption'],
  589. PGP: ['sign'],
  590. },
  591. securityMessages: {
  592. SMIME: {
  593. sign: {
  594. message: 'The certificate for %s was not found.',
  595. messagePlaceholder: ['zammad@localhost'],
  596. },
  597. encryption: {
  598. message: 'The certificates for %s were not found.',
  599. messagePlaceholder: ['nicole.braun@zammad.org'],
  600. },
  601. },
  602. PGP: {
  603. sign: {
  604. message: 'The PGP key for %s was found.',
  605. messagePlaceholder: ['zammad@localhost'],
  606. },
  607. encryption: {
  608. message: 'The PGP keys for %s were found.',
  609. messagePlaceholder: ['nicole.braun@zammad.org'],
  610. },
  611. },
  612. },
  613. },
  614. value: { method: 'SMIME', options: [] },
  615. },
  616. {
  617. type: 'permissions',
  618. name: 'permissions',
  619. label: 'Permissions',
  620. props: {
  621. options: permissions,
  622. },
  623. value: ['ticket.agent'],
  624. },
  625. {
  626. type: 'autocomplete',
  627. name: 'autocomplete',
  628. label: 'Autocomplete',
  629. props: {
  630. clearable: true,
  631. gqlQuery: gql`
  632. query autocompleteSearchUser($input: AutocompleteSearchUserInput!) {
  633. autocompleteSearchUser(input: $input) {
  634. value
  635. label
  636. disabled
  637. icon
  638. }
  639. }
  640. `,
  641. },
  642. },
  643. {
  644. type: 'externalDataSource',
  645. name: 'external_data_source',
  646. label: 'External Data Source',
  647. object: EnumObjectManagerObjects.Ticket,
  648. help: 'Please add external_data_source attribute on Ticket object. Otherwise this field will not work.',
  649. },
  650. {
  651. type: 'agent',
  652. name: 'agent',
  653. label: 'Agent',
  654. props: {
  655. clearable: true,
  656. },
  657. },
  658. {
  659. type: 'ticket',
  660. name: 'ticket',
  661. label: 'Ticket',
  662. props: {
  663. clearable: true,
  664. },
  665. },
  666. {
  667. type: 'recipient',
  668. name: 'recipient',
  669. label: 'Recipient',
  670. props: {
  671. clearable: true,
  672. },
  673. },
  674. {
  675. type: 'recipient',
  676. name: 'recipient_multiple',
  677. label: 'Recipient (multiple)',
  678. props: {
  679. clearable: true,
  680. multiple: true,
  681. },
  682. },
  683. {
  684. type: 'customer',
  685. name: 'customer',
  686. label: 'Customer',
  687. props: {
  688. clearable: true,
  689. link: '/',
  690. linkIcon: 'person-add',
  691. },
  692. },
  693. {
  694. type: 'organization',
  695. name: 'organization',
  696. label: 'Organization',
  697. props: {
  698. clearable: true,
  699. options: [
  700. {
  701. value: 1,
  702. label: 'Zammad Foundation',
  703. organization: {
  704. active: true,
  705. },
  706. },
  707. ],
  708. },
  709. },
  710. {
  711. type: 'tags',
  712. name: 'tags',
  713. label: 'Tags',
  714. props: {
  715. clearable: true,
  716. canCreate: application.config.tag_new,
  717. },
  718. },
  719. {
  720. name: 'date_0',
  721. label: 'Date',
  722. type: 'date',
  723. props: {
  724. clearable: true,
  725. },
  726. },
  727. {
  728. name: 'date_1',
  729. label: 'Date range',
  730. type: 'date',
  731. props: {
  732. clearable: true,
  733. range: true,
  734. },
  735. },
  736. {
  737. name: 'datetime_0',
  738. label: 'Date/Time',
  739. type: 'datetime',
  740. props: {
  741. clearable: true,
  742. },
  743. },
  744. {
  745. name: 'group_permission_0',
  746. label: 'Group permissions',
  747. type: 'groupPermissions',
  748. props: {
  749. options: [
  750. {
  751. value: 1,
  752. label: 'Users',
  753. },
  754. {
  755. value: 2,
  756. label: 'some_group1',
  757. children: [
  758. {
  759. value: 3,
  760. label: 'Nested group',
  761. },
  762. ],
  763. },
  764. ],
  765. },
  766. },
  767. {
  768. type: 'select',
  769. name: 'select_1',
  770. label: 'Single select',
  771. props: {
  772. options: [...alphabetOptions.value, ...[longOption.value]],
  773. clearable: true,
  774. },
  775. },
  776. {
  777. type: 'select',
  778. name: 'select_2',
  779. label: 'Multi select',
  780. props: {
  781. multiple: true,
  782. options: [...alphabetOptions.value, ...[longOption.value]],
  783. clearable: true,
  784. },
  785. },
  786. {
  787. type: 'treeselect',
  788. name: 'treeselect_1',
  789. label: 'Single treeselect',
  790. props: {
  791. options: treeselectOptions,
  792. clearable: true,
  793. },
  794. },
  795. {
  796. type: 'treeselect',
  797. name: 'treeselect_2',
  798. label: 'Multi treeselect',
  799. props: {
  800. multiple: true,
  801. options: treeselectOptions,
  802. clearable: true,
  803. },
  804. },
  805. {
  806. type: 'toggleList',
  807. name: 'roles',
  808. label: 'Roles',
  809. props: {
  810. options: [
  811. { value: 3, label: 'name only' },
  812. { value: 1, label: 'Long name', description: 'Note here' },
  813. {
  814. value: 1111,
  815. label: 'Another long name',
  816. description: 'Note here again',
  817. },
  818. ],
  819. },
  820. },
  821. {
  822. type: 'radioList',
  823. name: 'radioRoles',
  824. label: 'Radio roles',
  825. value: 1,
  826. props: {
  827. options: [
  828. { value: 3, label: 'name only' },
  829. { value: 33333, label: 'name onlyyyy' },
  830. { value: 1, label: 'Long name', description: 'Note here' },
  831. {
  832. value: 1111,
  833. label: 'Another long name',
  834. description: 'Note here again',
  835. },
  836. ],
  837. },
  838. },
  839. {
  840. type: 'file',
  841. name: 'file',
  842. label: 'Attachment',
  843. props: {
  844. multiple: true,
  845. },
  846. },
  847. {
  848. type: 'toggleButtons',
  849. name: 'toggleButtons',
  850. label: 'Toggle Buttons',
  851. value: '1',
  852. props: {
  853. options: [
  854. { value: '3', label: 'name only' },
  855. { value: '33333', label: 'name onlyyyy' },
  856. { value: '1', label: 'Long name', icon: 'sun' },
  857. ],
  858. },
  859. },
  860. ])
  861. const formValues = ref()
  862. const formInitialValues: FormValues = {
  863. roles: [3, 1],
  864. // date_0: [new Date(), new Date(new Date().setDate(new Date().getDate() + 7))],
  865. }
  866. const progressBarValue = ref(0)
  867. const increaseProgressBar = () => {
  868. progressBarValue.value += 25
  869. }
  870. onMounted(() => {
  871. setInterval(increaseProgressBar, 2000)
  872. })
  873. watch(progressBarValue, (newValue) => {
  874. if (newValue < 100) return
  875. setTimeout(() => {
  876. progressBarValue.value = 0
  877. }, 1000)
  878. })
  879. const session = useSessionStore()
  880. const { user } = storeToRefs(session)
  881. const { isOpen: popoverIsOpen, popover, popoverTarget, toggle } = usePopover()
  882. const themeSwitchInstance = useTemplateRef('theme-switch')
  883. const cycleThemeSwitchValue = () => {
  884. themeSwitchInstance.value?.cycleValue()
  885. }
  886. const appearance = ref('auto')
  887. const schema: FormSchemaNode[] = [
  888. {
  889. type: 'text',
  890. name: 'code',
  891. label: 'Test',
  892. required: true,
  893. props: {
  894. help: 'Enter here something',
  895. },
  896. },
  897. ]
  898. const flyout = useFlyout({
  899. name: 'playground',
  900. component: () =>
  901. new Promise((resolve) => {
  902. return resolve(
  903. h(
  904. CommonFlyout,
  905. {
  906. onClose: () => {
  907. console.log(
  908. '%c %s',
  909. 'color: red; font-size: 16px',
  910. 'Flyout closed!',
  911. )
  912. },
  913. onAction: () => {
  914. console.log(
  915. '%c %s',
  916. 'color: green; font-size: 16px',
  917. 'Flyout action!',
  918. )
  919. },
  920. name: 'playground',
  921. headerTitle: 'Hello Playground',
  922. persistWidth: true,
  923. headerIcon: 'buildings',
  924. footerActionOptions: {
  925. actionLabel: 'Submit test',
  926. cancelLabel: 'Adios',
  927. actionButton: {
  928. type: 'submit',
  929. variant: 'primary',
  930. prefixIcon: 'check2',
  931. },
  932. },
  933. },
  934. {
  935. default: () => [
  936. h('div', { class: 'py-1' }, [
  937. h('input'),
  938. h(Form, { ref: 'flyoutForm', schema }),
  939. h('div', { class: 'w-[400px]', innerHTML: 'Hello world!' }),
  940. h(
  941. 'p',
  942. ' Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab laborum magnam omnis qui, ratione similique velit voluptatem. Cumque esse et, expedita inventore, iusto laboriosam magnam minus necessitatibus numquam odio odit optio quaerat, quidem quo quos reiciendis rem similique ut veniam vero. Aperiam at blanditiis dignissimos est et, ex harum id in itaque magni natus neque officia omnis perferendis quaerat, quasi ratione reiciendis sunt vitae voluptatum. At id obcaecati odio rerum sed! Accusamus aliquid assumenda cupiditate deleniti distinctio dolore dolores ea earum enim eos error esse ex expedita hic id incidunt iste laudantium molestias nisi obcaecati omnis placeat quam quibusdam quis, quod ratione rem repellendus reprehenderit sed sint soluta velit vitae voluptas voluptate voluptatem voluptates voluptatum. Delectus facilis nostrum praesentium quos sed. Ad assumenda atque cum cumque distinctio dolorem dolores excepturi explicabo harum impedit iusto labore, laboriosam laudantium libero minima nam pariatur quasi quisquam rem repellat reprehenderit saepe sapiente, tempora ut voluptates! Assumenda distinctio impedit veniam vitae voluptates! Aperiam, at commodi dignissimos ex exercitationem inventore quibusdam sequi veniam! A ab accusamus aperiam architecto atque beatae blanditiis commodi consequatur, deleniti deserunt dolor ducimus eaque ex excepturi illum incidunt ipsum laboriosam magni minus molestiae nam nesciunt nulla odit perferendis perspiciatis possimus quod quos similique sint suscipit temporibus unde veritatis voluptatibus? Ab ad, adipisci animi beatae ea eaque eligendi explicabo id impedit itaque magni mollitia nihil numquam obcaecati odit officia omnis perferendis porro quaerat quasi quod repellendus sint sunt suscipit, tenetur vel veniam. Ad animi architecto, aspernatur at blanditiis cumque delectus deleniti dolorem dolorum eos eum eveniet facilis fuga fugiat hic ipsam iure laboriosam maiores natus nisi nobis nulla officiis optio perferendis porro quaerat quam qui quo, repellat sed similique sint suscipit tenetur ullam veritatis vitae voluptates. A ad illo minima nisi nobis vitae voluptatem? Autem deleniti error maiores minus pariatur porro quidem suscipit!',
  943. ),
  944. ]),
  945. ],
  946. },
  947. ),
  948. )
  949. }),
  950. })
  951. const dialog = useDialog({
  952. name: 'playground',
  953. component: () =>
  954. new Promise((resolve) => {
  955. return resolve(
  956. h(CommonDialog, {
  957. name: 'playground',
  958. headerTitle: 'Confirmation',
  959. content: 'Do you want to continue?',
  960. }),
  961. )
  962. }),
  963. })
  964. const { waitForVariantConfirmation } = useConfirmation()
  965. const deleteTest = async () => {
  966. const confirmed = await waitForVariantConfirmation('delete')
  967. if (confirmed) {
  968. console.log('Item deleted!')
  969. } else {
  970. console.log('Item not deleted!')
  971. }
  972. }
  973. const vip = ref(false)
  974. const tableHeaders = [
  975. {
  976. key: 'name',
  977. label: 'User name',
  978. },
  979. {
  980. key: 'title',
  981. label: 'Job position',
  982. truncate: true,
  983. },
  984. {
  985. key: 'email',
  986. label: 'Email',
  987. },
  988. {
  989. key: 'role',
  990. label: 'Role',
  991. },
  992. ]
  993. const tableItems = reactive([
  994. {
  995. id: 1,
  996. name: 'Lindsay Walton',
  997. title: 'Front-end Developer',
  998. email: 'lindsay.walton@example.com',
  999. role: 'Member',
  1000. },
  1001. {
  1002. id: 2,
  1003. name: 'Courtney Henry',
  1004. title: 'Designer',
  1005. email: 'courtney.henry@example.com',
  1006. role: 'Admin',
  1007. },
  1008. {
  1009. id: 3,
  1010. name: 'Tom Cook',
  1011. title: 'Director of Product',
  1012. email: 'tom.cook@example.com',
  1013. role: 'Member',
  1014. },
  1015. {
  1016. id: 4,
  1017. name: 'Whitney Francis',
  1018. title: 'Copywriter',
  1019. email: 'whitney.francis@example.com',
  1020. role: 'Admin',
  1021. },
  1022. {
  1023. id: 5,
  1024. name: 'Leonard Krasner',
  1025. title: 'Senior Designer Principal Designer ',
  1026. email: 'leonard.krasner@example.com',
  1027. role: 'Owner',
  1028. },
  1029. {
  1030. id: 6,
  1031. name: 'Floyd Miles',
  1032. title:
  1033. 'Principal Designer for a very long way to go to see the end of the title. It is a very long title, indeed.',
  1034. email: 'floyd.miles@example.com',
  1035. role: 'Member',
  1036. },
  1037. ])
  1038. const tableActions: MenuItem[] = [
  1039. {
  1040. key: 'delete',
  1041. label: 'Delete this row',
  1042. icon: 'trash3',
  1043. show: (data) => !!data?.role,
  1044. onClick: (data) => {
  1045. console.log(data)
  1046. },
  1047. },
  1048. {
  1049. key: 'download',
  1050. label: 'Download this row',
  1051. icon: 'download',
  1052. onClick: (data) => {
  1053. console.log(data)
  1054. },
  1055. },
  1056. ]
  1057. const changeRow = () => {
  1058. tableItems[0].role = tableItems[0].role ? '' : 'Member'
  1059. }
  1060. const { activeTab } = useTabManager<string>()
  1061. const { activeTab: activeFilters } = useTabManager<string[]>()
  1062. const popoverOrientation: Ref<Orientation> = ref('autoVertical')
  1063. const popoverOrientationOptions = [
  1064. {
  1065. value: 'autoVertical',
  1066. label: 'Auto vertical',
  1067. },
  1068. {
  1069. value: 'autoHorizontal',
  1070. label: 'Auto horizontal',
  1071. },
  1072. {
  1073. value: 'top',
  1074. label: 'Top',
  1075. },
  1076. {
  1077. value: 'bottom',
  1078. label: 'Bottom',
  1079. },
  1080. {
  1081. value: 'left',
  1082. label: 'Left',
  1083. },
  1084. {
  1085. value: 'right',
  1086. label: 'Right',
  1087. },
  1088. ]
  1089. const popoverPlacement: Ref<Placement> = ref('start')
  1090. const popoverPlacementOptions = [
  1091. {
  1092. value: 'start',
  1093. label: 'Start',
  1094. },
  1095. {
  1096. value: 'arrowStart',
  1097. label: 'Arrow Start',
  1098. },
  1099. {
  1100. value: 'arrowEnd',
  1101. label: 'Arrow End',
  1102. },
  1103. {
  1104. value: 'end',
  1105. label: 'End',
  1106. },
  1107. ]
  1108. const breadcrumbItems = [
  1109. {
  1110. label: 'Tickets',
  1111. icon: 'logo-flat',
  1112. },
  1113. {
  1114. label: '123456',
  1115. route: 'tickets/1',
  1116. },
  1117. ]
  1118. const popoverHideArrow = ref(false)
  1119. const inlineEditValue = ref('Edit me inline')
  1120. </script>
  1121. <template>
  1122. <LayoutContent :breadcrumb-items="[]">
  1123. <div>
  1124. <div class="w-1/2">
  1125. <div class="flex space-x-3 py-2">
  1126. <CommonTranslateRenderer
  1127. source="A %s for advanced %s here. Inside a translation string: %s"
  1128. :placeholders="[
  1129. 'test',
  1130. {
  1131. type: 'link',
  1132. props: { link: 'https://www.google.com' },
  1133. content: 'Link',
  1134. },
  1135. {
  1136. type: 'link',
  1137. props: { link: 'https://www.google.com' },
  1138. content: 'Example',
  1139. },
  1140. ]"
  1141. />
  1142. </div>
  1143. <h1 id="test" v-tooltip="'Hello world'" class="w-fit">
  1144. Tooltip example
  1145. </h1>
  1146. <h2 title="Buttons" class="text-xl">Buttons</h2>
  1147. <h3 v-tooltip="'another example'">Text only</h3>
  1148. <div class="flex space-x-3 py-2">
  1149. <CommonButton variant="primary" />
  1150. <CommonButton variant="secondary" />
  1151. <CommonButton variant="tertiary" />
  1152. <CommonButton variant="submit" />
  1153. <CommonButton variant="danger" />
  1154. <CommonButton variant="subtle" />
  1155. <CommonButton variant="neutral" />
  1156. </div>
  1157. <h3>With icon</h3>
  1158. <div class="flex space-x-3 py-2">
  1159. <CommonButton variant="primary" prefix-icon="logo-flat" />
  1160. <CommonButton variant="secondary" prefix-icon="logo-flat" />
  1161. <CommonButton variant="tertiary" prefix-icon="logo-flat" />
  1162. <CommonButton variant="submit" prefix-icon="logo-flat" />
  1163. <CommonButton variant="danger" prefix-icon="logo-flat" />
  1164. <CommonButton variant="subtle" prefix-icon="logo-flat" />
  1165. <CommonButton variant="neutral" prefix-icon="logo-flat" />
  1166. </div>
  1167. <h3>Icon only</h3>
  1168. <div class="flex items-center space-x-3 py-2">
  1169. <CommonButton variant="primary" icon="logo-flat" />
  1170. <CommonButton variant="secondary" icon="logo-flat" />
  1171. <CommonButton variant="tertiary" icon="logo-flat" />
  1172. <CommonButton variant="submit" icon="logo-flat" />
  1173. <CommonButton variant="danger" icon="logo-flat" />
  1174. <CommonButton variant="subtle" icon="logo-flat" />
  1175. <CommonButton variant="neutral" icon="logo-flat" />
  1176. <CommonButton variant="primary" icon="logo-flat" size="medium" />
  1177. <CommonButton variant="secondary" icon="logo-flat" size="medium" />
  1178. <CommonButton variant="tertiary" icon="logo-flat" size="medium" />
  1179. <CommonButton variant="submit" icon="logo-flat" size="medium" />
  1180. <CommonButton variant="danger" icon="logo-flat" size="medium" />
  1181. <CommonButton variant="subtle" icon="logo-flat" size="medium" />
  1182. <CommonButton variant="neutral" icon="logo-flat" size="medium" />
  1183. <CommonButton variant="primary" icon="logo-flat" size="large" />
  1184. <CommonButton variant="secondary" icon="logo-flat" size="large" />
  1185. <CommonButton variant="tertiary" icon="logo-flat" size="large" />
  1186. <CommonButton variant="submit" icon="logo-flat" size="large" />
  1187. <CommonButton variant="danger" icon="logo-flat" size="large" />
  1188. <CommonButton variant="subtle" icon="logo-flat" size="large" />
  1189. <CommonButton variant="neutral" icon="logo-flat" size="large" />
  1190. </div>
  1191. <h3>Misc</h3>
  1192. <div class="flex-wrap space-x-3 space-y-2 py-2">
  1193. <CommonButton variant="submit" block>Block</CommonButton>
  1194. <CommonButton variant="primary" disabled>Disabled</CommonButton>
  1195. <CommonButton variant="secondary" disabled>Disabled</CommonButton>
  1196. <CommonButton variant="tertiary" disabled>Disabled</CommonButton>
  1197. <CommonButton variant="submit" disabled>Disabled</CommonButton>
  1198. <CommonButton variant="danger" disabled>Disabled</CommonButton>
  1199. <CommonButton variant="subtle" disabled>Disabled</CommonButton>
  1200. <CommonButton variant="neutral" disabled>Disabled</CommonButton>
  1201. </div>
  1202. <h3>Group</h3>
  1203. <div class="w-1/2 space-x-3 space-y-2 py-2">
  1204. <CommonButtonGroup :items="buttonGroupOptions" />
  1205. </div>
  1206. </div>
  1207. <div class="flex">
  1208. <CommonBreadcrumb class="grow" :items="breadcrumbItems">
  1209. <template #trailing>
  1210. <CommonIcon
  1211. name="files"
  1212. size="xs"
  1213. class="text-blue-800"
  1214. @click="copyToClipboard('123456')"
  1215. />
  1216. </template>
  1217. </CommonBreadcrumb>
  1218. </div>
  1219. <div class="w-1/2">
  1220. <h2 class="text-xl">Alerts</h2>
  1221. <CommonAlert variant="info" dismissible class="mb-2.5"
  1222. >It's Friday!
  1223. </CommonAlert>
  1224. <CommonAlert variant="success" class="mb-2.5">
  1225. <div class="flex flex-col gap-1.5">
  1226. <CommonLabel class="text-yellow-600" size="large"
  1227. >Similar tickets found</CommonLabel
  1228. >
  1229. <CommonLabel class="text-yellow-600"
  1230. >Tickets with the same attributes were found.</CommonLabel
  1231. >
  1232. <ul class="list-inside list-disc">
  1233. <li>31001 Test Ticket</li>
  1234. </ul>
  1235. </div>
  1236. </CommonAlert>
  1237. <CommonAlert variant="warning" class="mb-2.5"
  1238. >Heee! You're typing too fast.
  1239. </CommonAlert>
  1240. <CommonAlert variant="danger" class="mb-2.5"
  1241. >Ooops! You broke it.
  1242. </CommonAlert>
  1243. </div>
  1244. <div>
  1245. <h2>Labels</h2>
  1246. <CommonLabel size="small" prefix-icon="logo" suffix-icon="logo-flat">
  1247. Small
  1248. </CommonLabel>
  1249. <br />
  1250. <CommonLabel size="medium" prefix-icon="logo" suffix-icon="logo-flat">
  1251. Medium
  1252. </CommonLabel>
  1253. <br />
  1254. <CommonLabel size="large" prefix-icon="logo" suffix-icon="logo-flat">
  1255. Large
  1256. </CommonLabel>
  1257. <br />
  1258. <CommonLabel size="xl" prefix-icon="logo" suffix-icon="logo-flat">
  1259. Extra large
  1260. </CommonLabel>
  1261. </div>
  1262. <div>
  1263. <h2>Badges</h2>
  1264. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="neutral">
  1265. Neutral
  1266. </CommonBadge>
  1267. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="info">Info</CommonBadge>
  1268. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="success">
  1269. Success
  1270. </CommonBadge>
  1271. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="warning">
  1272. Warning
  1273. </CommonBadge>
  1274. <CommonBadge class="ltr:mr-2 rtl:ml-2" variant="danger">
  1275. Danger
  1276. </CommonBadge>
  1277. <CommonBadge
  1278. class="bg-pink-300 text-white ltr:mr-2 rtl:ml-2 dark:bg-pink-300"
  1279. variant="custom"
  1280. >Custom
  1281. </CommonBadge>
  1282. </div>
  1283. <div class="w-1/5">
  1284. <h2>Progress Bar</h2>
  1285. <div class="flex flex-col gap-3">
  1286. <div class="flex flex-col gap-2">
  1287. <CommonLabel size="small">What is the meaning of life?</CommonLabel>
  1288. <CommonProgressBar />
  1289. </div>
  1290. <div class="flex items-end gap-2">
  1291. <div class="mb-1 flex grow flex-col gap-1">
  1292. <div class="flex justify-between">
  1293. <CommonLabel size="small">Organizations</CommonLabel>
  1294. <CommonLabel
  1295. class="text-stone-200 dark:text-neutral-500"
  1296. size="small"
  1297. >
  1298. {{ progressBarValue }} of 100
  1299. </CommonLabel>
  1300. </div>
  1301. <CommonProgressBar
  1302. :value="progressBarValue.toString()"
  1303. max="100"
  1304. />
  1305. </div>
  1306. <CommonIcon
  1307. class="shrink-0 fill-green-500"
  1308. :class="progressBarValue !== 100 ? 'invisible' : undefined"
  1309. name="check2"
  1310. size="tiny"
  1311. decorative
  1312. />
  1313. </div>
  1314. </div>
  1315. </div>
  1316. <h2 class="mb-2 mt-8">Table</h2>
  1317. <div class="mb-6 flex flex-col gap-4">
  1318. <CommonButton variant="primary" @click="changeRow()"
  1319. >Change row</CommonButton
  1320. >
  1321. <CommonSimpleTable
  1322. :headers="tableHeaders"
  1323. :items="tableItems"
  1324. :actions="tableActions"
  1325. ></CommonSimpleTable>
  1326. </div>
  1327. <div class="w-1/2">
  1328. <h2 class="text-lg">Avatar</h2>
  1329. <div class="my-4 flex items-center gap-4">
  1330. <CommonUserAvatar
  1331. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1332. tabindex="0"
  1333. :entity="{
  1334. id: 'gid://zammad/User/1',
  1335. vip,
  1336. }"
  1337. size="medium"
  1338. />
  1339. <CommonButton
  1340. :variant="vip ? 'neutral' : 'subtle'"
  1341. @click="vip = !vip"
  1342. >
  1343. {{ vip ? 'Make us unimportant :(' : 'Make us important :)' }}
  1344. </CommonButton>
  1345. </div>
  1346. <div class="flex gap-4">
  1347. <CommonUserAvatar
  1348. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1349. tabindex="0"
  1350. :entity="{
  1351. id: 'gid://zammad/User/2',
  1352. firstname: 'Alfa',
  1353. lastname: 'Bravo',
  1354. vip,
  1355. }"
  1356. size="xs"
  1357. />
  1358. <CommonUserAvatar
  1359. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1360. tabindex="0"
  1361. :entity="{
  1362. id: 'gid://zammad/User/3',
  1363. firstname: 'Charlie',
  1364. lastname: 'Delta',
  1365. vip,
  1366. }"
  1367. size="small"
  1368. />
  1369. <CommonUserAvatar
  1370. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1371. tabindex="0"
  1372. :entity="{
  1373. id: 'gid://zammad/User/4',
  1374. firstname: 'Echo',
  1375. lastname: 'Foxtrot',
  1376. vip,
  1377. }"
  1378. size="medium"
  1379. />
  1380. <CommonUserAvatar
  1381. class="cursor-pointer outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1382. tabindex="0"
  1383. :entity="{
  1384. id: 'gid://zammad/User/5',
  1385. firstname: 'Golf',
  1386. lastname: 'Hotel',
  1387. vip,
  1388. }"
  1389. size="normal"
  1390. />
  1391. <CommonUserAvatar
  1392. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1393. tabindex="0"
  1394. :entity="{
  1395. id: 'gid://zammad/User/6',
  1396. firstname: 'India',
  1397. lastname: 'Juliett',
  1398. vip,
  1399. }"
  1400. size="large"
  1401. />
  1402. <CommonUserAvatar
  1403. class="cursor-pointer border border-neutral-100 outline outline-2 outline-transparent hover:outline-blue-600 focus:outline-blue-800 dark:border-gray-900 dark:hover:outline-blue-900 dark:hover:focus:outline-blue-800"
  1404. tabindex="0"
  1405. :entity="{
  1406. id: 'gid://zammad/User/7',
  1407. firstname: 'Kilo',
  1408. lastname: 'Lima',
  1409. vip,
  1410. }"
  1411. size="xl"
  1412. />
  1413. </div>
  1414. </div>
  1415. <div>
  1416. <h2 class="text-lg">Popover</h2>
  1417. <div class="mb-2 flex gap-2">
  1418. <FormKit
  1419. v-model="popoverOrientation"
  1420. type="select"
  1421. name="orientation"
  1422. :options="popoverOrientationOptions"
  1423. />
  1424. <FormKit
  1425. v-model="popoverPlacement"
  1426. type="select"
  1427. name="placement"
  1428. :options="popoverPlacementOptions"
  1429. />
  1430. <FormKit
  1431. v-model="popoverHideArrow"
  1432. type="toggle"
  1433. name="placement"
  1434. label="Hide arrow"
  1435. :variants="{ true: 'yes', false: 'no' }"
  1436. />
  1437. </div>
  1438. <template v-if="user">
  1439. <CommonPopover
  1440. ref="popover"
  1441. :owner="popoverTarget"
  1442. :orientation="popoverOrientation"
  1443. :placement="popoverPlacement"
  1444. :hide-arrow="popoverHideArrow"
  1445. >
  1446. <CommonPopoverMenu
  1447. :popover="popover"
  1448. header-label="Erika Mustermann"
  1449. :items="[
  1450. {
  1451. key: 'appearance',
  1452. label: 'Appearance',
  1453. icon: 'brightness-alt-high',
  1454. noCloseOnClick: true,
  1455. onClick: cycleThemeSwitchValue,
  1456. },
  1457. {
  1458. key: 'keyboard-shortcuts',
  1459. label: 'Keyboard shortcuts',
  1460. onClick: () => {
  1461. console.log('OPEN KEYBOARD SHORTCUTS DIALOG')
  1462. },
  1463. icon: 'keyboard',
  1464. },
  1465. {
  1466. key: 'personal-setting',
  1467. label: 'Profile settings',
  1468. link: '/personal-setting',
  1469. icon: 'person-gear',
  1470. },
  1471. {
  1472. key: 'sign-out',
  1473. label: 'Sign out',
  1474. link: '/logout',
  1475. icon: 'box-arrow-in-right',
  1476. separatorTop: true,
  1477. },
  1478. ]"
  1479. >
  1480. <template #itemRight-appearance>
  1481. <div class="flex items-center px-2">
  1482. <ThemeSwitch
  1483. ref="theme-switch"
  1484. v-model="appearance"
  1485. size="small"
  1486. />
  1487. </div>
  1488. </template>
  1489. </CommonPopoverMenu>
  1490. </CommonPopover>
  1491. <button
  1492. ref="popoverTarget"
  1493. class="-:outline-transparent hover:-:outline-blue-900 rounded-full outline outline-2 focus:outline-blue-800 hover:focus:outline-blue-800"
  1494. :class="{
  1495. 'outline-blue-800 hover:outline-blue-800': popoverIsOpen,
  1496. }"
  1497. @click="toggle(true)"
  1498. >
  1499. <CommonUserAvatar :entity="user" size="large" personal />
  1500. </button>
  1501. </template>
  1502. </div>
  1503. <section>
  1504. <h2>Common Action Menu</h2>
  1505. <CommonActionMenu
  1506. :entity="{ id: 'test-me', name: 'playground' }"
  1507. :actions="[
  1508. {
  1509. key: 'delete-customer',
  1510. label: 'Delete Customer',
  1511. variant: 'danger',
  1512. icon: 'trash3',
  1513. onClick: (data) => {
  1514. console.log(data?.id, data?.name, 'Delete customer')
  1515. },
  1516. },
  1517. {
  1518. key: 'change-customer',
  1519. label: 'Change Customer',
  1520. icon: 'person-gear',
  1521. onClick: (data) => {
  1522. console.log(data?.id, data?.name, 'Change customer')
  1523. },
  1524. },
  1525. ]"
  1526. />
  1527. <h3>Single Action Item</h3>
  1528. <CommonActionMenu
  1529. :entity="{ id: 'test-me', name: 'playground' }"
  1530. :actions="[
  1531. {
  1532. key: 'change-customer',
  1533. label: 'Change Customer',
  1534. icon: 'person-gear',
  1535. onClick: (id) => {
  1536. console.log(id, 'Delete customer')
  1537. },
  1538. },
  1539. ]"
  1540. />
  1541. </section>
  1542. <div>
  1543. <span> Inline Edit </span>
  1544. <CommonInlineEdit
  1545. id="test"
  1546. :value="inlineEditValue"
  1547. @submit-edit="
  1548. (value) => {
  1549. inlineEditValue = value
  1550. }
  1551. "
  1552. />
  1553. </div>
  1554. <div class="w-1/2">
  1555. <h2 class="mb-2 mt-8">Flyout and Dialog</h2>
  1556. <div class="mb-6 flex gap-4">
  1557. <CommonButton variant="tertiary" @click="dialog.open()"
  1558. >Show Dialog
  1559. </CommonButton>
  1560. <CommonButton variant="primary" @click="flyout.open()">
  1561. Open Flyout
  1562. </CommonButton>
  1563. </div>
  1564. <h2 class="mb-2">Confirmation</h2>
  1565. <div class="mb-6 flex gap-4">
  1566. <CommonButton variant="tertiary" @click="deleteTest()"
  1567. >Delete
  1568. </CommonButton>
  1569. </div>
  1570. <h2 class="mb-2 mt-8">Input Copy To Clipboard</h2>
  1571. <div class="mb-6">
  1572. <CommonInputCopyToClipboard
  1573. value="some text to copy"
  1574. label="A label"
  1575. />
  1576. </div>
  1577. </div>
  1578. <div class="w-1/2">
  1579. <h2 class="text-lg">Form</h2>
  1580. <Form
  1581. id="playground-form"
  1582. v-model="formValues"
  1583. form-class="mb-2.5 space-y-2.5"
  1584. :schema="formSchema"
  1585. :initial-values="formInitialValues"
  1586. @submit="console.debug($event)"
  1587. >
  1588. <template #after-fields>
  1589. <div class="my-5 flex items-center justify-end gap-2">
  1590. <CommonButton
  1591. variant="secondary"
  1592. size="medium"
  1593. @click="reset('playground-form')"
  1594. >
  1595. Reset
  1596. </CommonButton>
  1597. <CommonButton variant="submit" type="submit" size="medium">
  1598. Submit
  1599. </CommonButton>
  1600. </div>
  1601. </template>
  1602. </Form>
  1603. <pre
  1604. class="flex flex-wrap gap-5 text-wrap rounded-lg bg-blue-200 p-5 font-mono text-sm text-gray-100 dark:bg-gray-700 dark:text-neutral-400"
  1605. >{{ formValues }}</pre
  1606. >
  1607. </div>
  1608. <h3>Tabs Groups</h3>
  1609. <CommonTabManager
  1610. v-model="activeTab"
  1611. :tabs="[
  1612. { label: 'Tab 1', key: 'tab-1' },
  1613. { label: 'Tab 2', default: true, key: 'tab-2' },
  1614. { label: 'Tab 3', key: 'tab-3' },
  1615. ]"
  1616. />
  1617. <h3>Filter Selector</h3>
  1618. <CommonTabManager
  1619. v-model="activeFilters"
  1620. label="Roles"
  1621. :tabs="[
  1622. { label: 'Admin', key: 'admin' },
  1623. { label: 'Agent', key: 'agent' },
  1624. { label: 'Customer', key: 'customer' },
  1625. ]"
  1626. multiple
  1627. />
  1628. </div>
  1629. </LayoutContent>
  1630. </template>