npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

quasar-app-components

v0.0.50

Published

Generate Form for quasar

Downloads

61

Readme

AppForm

Generate Form for quasar

Install npm or yarn

npm i quasar-app-components
yarn add quasar-app-components

Documentation

In your vue3 applications import component

<script setup lang="ts">
import { QInput } from 'quasar'
import { z } from 'zod'
import { AppForm, AppFormSchemaField } from 'quasar-app-components'

const modelSchema = z.object({
  name: z.string().noempty(),
})

const schema: AppFormSchemaField[] = [
  {
    scope: 'name',
    component: QInput,
    defaultValue: '',
    componentProps: {
      label: 'Namn',
      // component props i.e from quasar
      square: true,
    },
  },
]
</script>

<template>
  <app-form :schema="schema" :model-schema="modelSchema" />
</template>

AppForm

| Prop | | Default | Required | | -------------- | -------------------------------- | ------- | -------- | | schema | See AppFormSchemaField interface | | Yes | | modelSchema | A ZodType Object | | Yes | | colGutter | Gutter of columns | 'sm' | | | modelValue | Bind formData | | | | readonly | Make all fields readonly | false | | | disable | Make all fields disabled | false | | | loading | Bind loading prop buttons | false | | | fieldWrapper | Wrapper around all fields | 'div' | |

| Event | | | -------- | ----------------------------------- | | submit | Returns validated formData if valid | | reset | Reset formData to defaultValues | | error | Returns field errors |

| Slot | | | --------- | ----------------------------- | | top | Top slot for extra content | | bottom | Bottom slot for extra content | | [scope] | Overwrite schema component |

AppFormSchemaField interface

| Prop | | Default | Required | | ---------------- | ------------------------------------------------------------------ | ----------- | -------- | | scope | Object path i.e 'obj.value' | | Yes | | cols | Span number of cols (max 12) | 'cols-auto' | | | component | Field component | | Yes | | column | Column position in row | 1 | | | transform | Transform value function before setting to modelValue | | | | defaultValue | Default value of field if not specified in AppForm modelValue prop | | Yes | | componentProps | Props to add to component | | Yes |

AppSelect

Easy to use quasar q-select with filtering, add new value, checkbox list.

| Props | | | ------------------- | --------------------------------- | | exactFilterMatch | Filter exact | | transformNewValue | Transform new-value label & value |

<script setup lang="ts">
import { ref } from 'vue'
import { AppSelect } from 'quasar-app-components'

const model = ref([])
const options = [
   {
      value: 1,
      label: 'Test',
      // optional
      caption: 'Caption'
      disable: true
   },
   {
      value: 2,
      label: 'Test 2',
   }
]
</script>

<template>
  <app-select v-model="model" multiple :options="options" new-value />
</template>

AppModal

Uses quasar dialog plugin.

Open Modal

import { Dialog } from 'quasar'
import { useAppModal } from 'quasar-app-components'

useAppModal(Dialog, {
  // Qdialog props
  persistent: true,
  // Modal title
  title: 'Edit example',
  // Fetch data when open modal, and are provided when injecting modal in slot component
  dependencies: fetchDataArray,
  // Modal slot component content
  slot: {
    component: ExampleContentComponent,
    componentProps: {
      // Slot component props
      exampleProp: true,
    },
  },
})
// slot component
import { appModalInjectionKey } from 'quasar-app-components'

const props = defineProps<{ exampleProp: boolean }>()

const modal = inject(appModalInjectionKey) as AppModalProvider

// injected props
modal.pending // is submit pending
// data fetched in array from dependencies
modal.dependencyData
// onSubmit promise fn callback (sets pending prop and closes modal by itself)
modal.onSubmit(() => {
  return new Promise()
})
// close dialog (optional payload)
modal.onDialogOK()
// close dialog
modal.onDialogCancel()

AppList & AppListItem

Recursive list. Open nested items in new list menu

<script setup lang="ts">
import { ref } from 'vue'
import { QMenu } from 'quasar'
import { AppList, AppListItemProps } from 'quasar-app-components'

const listProps: QListProps = {
  dense: false,
}

const items = ref<AppListItemProps[]>([
  {
    // AppListitem props
    label: 'Settings',
    icon: 'mdi-an-icon',
    color: 'primary',
    visible: true,
    componentProps: {
      // QItem props
      disable: false,
    },
    items: [
      {
        label: 'More settings',
        clickFn: () => {
          // example open useAppModal()
        },
      },
    ],
  },
])
</script>

<template>
  <q-btn icon="mdi-dots-vertical">
    <q-menu square>
      <AppList :component="QMenu" :items="items" :props="listProps" />
    </q-menu>
  </q-btn>
  <!-- or -->
  <q-btn-dropdown label="Åtgärder">
    <AppList :items="items" />
  </q-btn-dropdown>
</template>