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

@axewo/nbasic-element

v0.0.24

Published

一个vue3+ts 的表单和列表组件库,依赖于element-plus,element-plus-icons-vue

Downloads

945

Readme

@axewo/nbasic-element

介绍

nbasic-element 根据element plus 的组件二次封装,使用 Vue3、TypeScript,技术栈。

组件说明

该组件库包含,table、form、 dialog

form 组件包含:element plus 的
ElInput,

ElAutocomplete,

ElCascader,

ElDatePicker,

ElInputNumber,

ElSwitch,

ElTimePicker,

ElTreeSelect,

ElSlider,

ElRate,

ElColorPicker,

ElDivider

USelect

UCheckboxGroup

URadioGroup

URadioButtonGroup

UApiSelect

BasicTable

BasicForm

TableAction

安装教程

1、安装该组件库,

# NPM
$ npm install @axewo/nbasic-element --save

# Yarn
$ yarn add @axewo/nbasic-element

# pnpm
$ pnpm install @axewo/nbasic-element

2、在页面应用

import '@axewo/nbasic-element/dist/style.css';
import NBasicUI from '@axewo/nbasic-element';


 app.use(NBasicUI);

使用说明

  1. table和form的使用的使用,包含页面查询,index.vue
<template>
    <div>
        <BasicTable @register="register">
            <template #leftToolbar>
                <TableAction
                    :is-tooltip="false"
                    :actions="[
                        {
                            label: '新增',
                            type: 'default',
                            link: false,
                            icon: 'Plus',
                            size: 'default',
                            onClick: handleAdd.bind(null),
                        },
                    ]"
                >
                </TableAction>
            </template>
            <template #actions="{ row }">
                <TableAction
                    :actions="[
                        {
                            // label: '修改',
                            type: 'primary',
                            icon: 'Edit',
                            tooltipProps: {
                                content: '修改',
                            },
                            onClick: handleEdit.bind(null, row),
                        },

                        {
                            // label: '删除',
                            type: 'danger',
                            icon: 'Delete',
                            tooltipProps: {
                                content: '删除',
                            },
                            popConfirm: {
                                title: '是否确认删除',
                                onConfirm: handleDelete.bind(null, row),
                            },
                        },
                        {
                            // label: '预览',
                            tooltipProps: {
                                content: '预览',
                            },
                            icon: 'View',
                            type: 'primary',
                            onClick: () => {
                                handlePerview(row);
                            },
                        },
                    ]"
                ></TableAction>
            </template>
        </BasicTable>
        <CloseAccountModal @register="registerDalog" @success="reload" />
    </div>
</template>

<script setup lang="ts">
import { tableSchema, searchSchema } from './config';
import { TableAction, useTable, useDialog } from '@axewo/nbasic-element';
import CloseAccountModal from './closeAccountModal.vue';
import { formCommonConfig, tableCommonConfig } from '@/utils';

const [registerDalog, { openModal }] = useDialog();
const [perviewDalog, { openModal: openModalPerview }] = useDialog();
const [register, { reload }] = useTable({
    apiFunc: listPageFunc,
    ...tableCommonConfig,
    useSearchForm: true,
    formConfig: {
        schemas: searchSchema,
        ...formCommonConfig,
    },
    columns: tableSchema,
});
const handleAdd = () => {
    openModal({
        title: '新增',
        visible: true,
        width: '30%',
    });
};
const handleEdit = (row: Recordable) => {
    openModal(
        {
            title: '修改',
            visible: true,
            width: '30%',
        },
        { ...row }
    );
};
const handlePerview = (row: Recordable) => {
    openModalPerview(
        {
            title: '预览',
            visible: true,
        },
        { ...row }
    );
};
const handleDelete = async ({ id }: Recordable) => {
    await removeFunc(id);
    reload();
};
</script>

config.ts

export const tableSchema = [
    {
        label: '业务实体',
        prop: 'comCode',
        render: ({ comCode }: Recordable) => {
            return h(DictTag, { dictType: 'com_code', value: comCode });
        },
    },

    {
        label: '关账流程标识',
        prop: 'processIndex',
        render: ({ processIndex, id }: Recordable) => {
            return h(
                RouterLink,
                { to: `/closeAccount/configure-task/index/${id}`, class: 'link-type' },
                ()=>processIndex
            );
        },
    },
    {
        label: '关账流程名称',
        prop: 'processName',
    },

    {
        prop: '_operate_',
        width: 130,
        align: 'center',
        label: '操作',
    },
];

export const searchSchema = [
    {
        label: '业务实体',
        field: 'comCode',
        component: 'ApiSelect',
        componentProps: {
            apiFunc: getOrgDropdownList,
            resultField: 'data',
            labelField: 'deptName',
            valueField: 'deptIndex',
        },
    },
 
];

弹框的使用

<template>
   <BasicModal  @register="registerModal" @ok="submit" @cancel="closeModal">
   	<div>
   		<BasicForm @register="register"></BasicForm>
   	</div>
   </BasicModal>
</template>

<script setup lang="ts">
import { formSchema } from './config'
import { useForm, useDialogInner,BasicModal } from '@axewo/nbasic-element'
import { sleep } from '@/utils/tools'
//这个register 必须要返回,否则控制套会有警告
const emits = defineEmits(['success','register'])

const [register, { getFieldsValue, clearValidate, updateSchema, setFieldsValue, validate }] = useForm({
   baseColProps: {
       span: 24
   },
   labelWidth: 150,
   schemas: formSchema,
   showActionButtonGroup: false
})

const [registerModal,{setModalProps,closeModal}] = useDialogInner((data:any) => {
   init(data)
})

const submit = async () => {
   try {
      //todo
   } catch (error) {
       console.log(error)
   }
}

const handleOk = () => {
   emits('success')
}
const init = async (record:any) => {

  //设置弹框中值
   setFieldsValue(record)
}
</script>