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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@toby.mosque/quasar-ui-qdecimal

v0.0.9

Published

QDecimal

Downloads

344

Readme

Component QDecimal

npm npm

Compatible with Quasar UI v2 and Vue 3.

Component QDecimal

in short, QDecimal is a QInput powered by the Intl.NumberFormat

Usage

Quasar CLI project

Install the App Extension.

OR:

Create and register a boot file:

import Vue from 'vue'
import Plugin from '@toby.mosque/quasar-ui-qdecimal'
import '@toby.mosque/quasar-ui-qdecimal/dist/index.css'

Vue.use(Plugin)

OR:

<style src="@toby.mosque/quasar-ui-qdecimal/dist/index.css"></style>

<script>
import { Component as QDecimal } from '@toby.mosque/quasar-ui-qdecimal'

export default {
  components: {
    QDecimal
  }
}
</script>

Vue CLI project

import Vue from 'vue'
import Plugin from '@toby.mosque/quasar-ui-qdecimal'
import '@toby.mosque/quasar-ui-qdecimal/dist/index.css'

Vue.use(Plugin)

OR:

<style src="@toby.mosque/quasar-ui-qdecimal/dist/index.css"></style>

<script>
import { Component as QDecimal } from '@toby.mosque/quasar-ui-qdecimal'

export default {
  components: {
    QDecimal
  }
}
</script>

UMD variant

Exports window.qDecimal.

Add the following tag(s) after the Quasar ones:

<head>
  <!-- AFTER the Quasar stylesheet tags: -->
  <link href="https://cdn.jsdelivr.net/npm/@toby.mosque/quasar-ui-qdecimal/dist/index.min.css" rel="stylesheet" type="text/css">
</head>
<body>
  <!-- at end of body, AFTER Quasar script(s): -->
  <script src="https://cdn.jsdelivr.net/npm/@toby.mosque/quasar-ui-qdecimal/dist/index.umd.min.js"></script>
</body>

If you need the RTL variant of the CSS, then go for the following (instead of the above stylesheet link):

<link href="https://cdn.jsdelivr.net/npm/@toby.mosque/quasar-ui-qdecimal/dist/index.rtl.min.css" rel="stylesheet" type="text/css">

QInput similarities and differences

let's review the QInput description

The QInput component is used to capture text input from the user. It uses v-model, similar to a regular input. It has support for errors and validation, and comes in a variety of styles, colors, and types.

Similarities

everything what applies to the QInput also applies to the QDecimal, so let say you wanna to style the QDecimal as dense and filled and configure the append slot to show a icon, you can follow the QInput docs and do the same:

<template>
  <q-decimal filled dense v-model="number">
    <template v-slot:append>
      <q-avatar>
        <img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg">
      </q-avatar>
    </template>
  </q-decimal>
</template>
<script setup lang="ts">
import { ref } from 'vue';

const number = ref(12.34);
</script>

Differences

QDecimal overrides the behavior of that 6 properties.

| Property | Detail | |---|---| | modelValue | the modelValue/v-model only accept number values, so you can't pass a string as you would do with the QInput. | | type | the default value is tel instead of text, that ensures that a numerical keyboard will appear instead of the full one. I opted by the tel instead of the number because of the odd behaviors of the later one. | | min | min will prevent the user to input values smaller than the expected. | | max | max will prevent the user to input values greater than the expected. | | prefix | will also accept a boolean, if true, the prefix will depend of the combination of the mode, the currency and the display. e.g: if mode: currency, currency: EUR and display: symbol so the displayed preffix will be | | suffix | will also accept a boolean, if true, the prefix will depend of the combination of the mode, the currency and the display. e.g: if mode: currency, currency: EUR and display: symbol so the displayed preffix will be |

QDecimal additional properties

| Property | Default | Detail | |---|---|---| | preset | _default | preset is a preconfigure and reusable set of properties, for example, you can configure a preset called de-money with mode: 'currency' and places: 2, in this case, you set preset="money" instead of mode="currency" :places="2" | | lang | -- | A string with a BCP 47 language tag. e.g.: en-US, en, pt-BR, es. the default will be same as the quasar lang package. | | mode | decimal | The formatting style to use. possivel values: decimal, currency, percent or unit | | currency | max | A string with the ISO 4217 currency codes. e.g.: USD, EUR or BRL. | | display | symbol | How to format the currency symbol. e.g.: symbol, narrowSymbol, code or name. | | places | -- | The maximum number of significant digits to use. | | precision | 2 | The maximum number of fraction digits to use. | | step | 1 | the values what would be increated when is pressed or decreased when is pressed. |

Composables

We`d two composables who helps to configure the presets:

createPreset

createPreset allow the dev to create a new preset what can be used later.

type

interface PresetPayload {
  type?: string
  suffix?: string | boolean,
  prefix?: string | boolean,
  mode?: "decimal" | "currency" | "percent"
  currency?: string,
  display?: "symbol" | "code" | "name",
  places?: number,
  precision?: number,
  step?: number
}

export function createPreset(name: string, {
  type = 'tef',
  preffix = undefined,
  suffix = undefined,
  mode = 'decimal',
  currency = undefined,
  display = 'symbol',
  places = undefined,
  precision = 2,
  step = 1
}: PresetPayload = {}) {

}

usage

import { createPreset } from '@toby.mosque/quasar-ui-qdecimal'

createPreset('money', {
  preffix: true,
  mode: 'currency',
  currency: 'EUR',
})

usePreset

usePreset allow to modify a previously created preset.

type

import type { ToRefs } from 'vue'
interface PresetPayload {
  type?: string
  suffix?: string | boolean,
  prefix?: string | boolean,
  mode?: "decimal" | "currency" | "percent"
  currency?: string,
  display?: "symbol" | "code" | "name",
  places?: number,
  precision?: number,
  step?: number
}

export function usePreset(name: string) : ToRefs<PresetPayload> {

}

usage

<template>
  <q-form class="row q-col-gutter-sm">
    <div class="col">
      <q-select label="Mode" v-model="mode" :options="modes"></q-select>
    </div>
    <div class="col">
      <q-select label="Currency" v-model="currency" :options="currencies"></q-select>
    </div>
    <div class="col">
      <q-checkbox label="Preffix" v-model="preffix"></q-checkbox>
    </div>
    <div class="col">
      <q-decimal preset="money" v-model="number"></q-decimal>
    </div>
  <q-form>
</template>
<script setup lang="ts">
import { usePreset } from '@toby.mosque/quasar-ui-qdecimal'
import { ref } from 'vue'

const { preffix, mode, currency } = usePreset('money')
const modes = ['decimal', 'currency', 'percentage']
const currencies = ['EUR', 'USD', 'BRL']
const number = ref(12.34);
</script>

Setup

$ yarn

Developing

# start dev in SPA mode
$ yarn dev

# start dev in UMD mode
$ yarn dev:umd

# start dev in SSR mode
$ yarn dev:ssr

# start dev in Cordova iOS mode
$ yarn dev:ios

# start dev in Cordova Android mode
$ yarn dev:android

# start dev in Electron mode
$ yarn dev:electron

Building package

$ yarn build

Adding Testing Components

in the ui/dev/src/pages you can add Vue files to test your component/directive. When using yarn dev to build the UI, any pages in that location will automatically be picked up by dynamic routing and added to the test page.

Adding Assets

If you have a component that has assets, like language or icon-sets, you will need to provide these for UMD. In the ui/build/script.javascript.js file, you will find a couple of commented out commands that call addAssets. Uncomment what you need and add your assets to have them be built and put into the ui/dist folder.

Donate

If you appreciate the work that went into this, please consider donating to Quasar.

License

MIT (c) Tobias Mesquita [email protected]