0.17.39 • Published 1 year ago

kmh-common-components v0.17.39

Weekly downloads
460
License
-
Repository
-
Last release
1 year ago

kmh-common-components

A pack of frontend vue components based on VueMaterial and css grid.

Tech

kmh-common-components uses only VueMaterial material design library as dependency:

Demo

To start demo app simply run

npm install
npm run serve

or

yarn
yarn serve

Usage

Installation

Install the dependencies.

$ npm i vue-material
$ yarn add vue-material

Install components

$ npm i kmh-common-components
$ yarn add kmh-common-components

Use components

import kmhCommonComponents from 'kmh-common-components';
import 'kmh-common-components/dist/kmh-common-components.css';

Vue.use(kmhCommonComponents);

Components settings

Our components pack uses predefined css grid style. 1. NavigationDrawer - first bar on the left 2. Infobox - 2nd from left 3. Infopanel - 3rd from left (optional) 4. Sidebar - slides in/out from right, as top layer in app 5. CartPopupContent - Content component from inside the cart popup for use outside a popup

Optional you can use your own toolbar component as horizontal header i.e.:

.main-header {
    grid-row: 1
    grid-column: 1 / 5
    height: 50px
    background: #dedede
}

An full example of the use of this components is given in die Demo.

NavigationDrawer

Used as main navigation vertical bar.

  • in template
<kmh-navigation-drawer
  :items="navItems"
  :settingsItems="settingsItems"
  @list-item-changed="listItemChanged"
  @delete-cart-item="deleteCartItem"
  @edit-cart-item="editCartItem"
/>
  • to configure navigationItems in NavigationDrawer pass as property an Array of Objects i.e.
 {
    icon: 'people', //material icon name
    action: this.dummy,
    actionArgs: ['first argument', 9999],
    disabled: false
 }
  • you can pass also settingsItems, to show buttons at the bottom of NavigationDrawer

NavigationItems & SettingsItems Props

property namedescriptiontypeexample
iconicon to showString'people'
activeset css style to activeBooleantrue/false
disableddisables itemBooleantrue/false
actioncallback to fire on menu item clickFunction
actionArgsarguments which will be passed to action callbackArray1,'test'
submenuItemsif not null, on click submenu will be shownObjectsee below
listItemsif not null, on click popup Checklist will be shownObjectsee below
cartItemsif not null, on click popup Cart will be shownObjectsee below

SettingsItems (only) Props

property namedescriptiontypeexample
contentonly used to pass i.e. initials for settingsItem, with combination icon: null, will be show as rounded buttonString'PT'

submenuItem Object

 { icon: 'people', title: 'submenu name', action: this.dummy, actionArgs: ['first argument', 9999] }

listItem Object

{
    title: 'another list',
    items: [
      { title: 'test first title', done: false },
      { title: 'totedo 2nd title long description', done: true }
    ]
 }

cartItem Object

{
    icon: 'shopping_cart',
    title: 'Warenkorb',
    actions: {
      showButtons: true,
      activeOnTab: 1,
      buttons: [
        { name: 'Gesprächsaufzeichnung', action: this.cartActionButton }
      ]
    },
    categories: [
      'Energie',
      'Zusatzangebote'
    ],
    finalProducts: [],
    notFinalProducts: [],
    notFinalProducts: [],
    unvalidatedProducts: [],
    additionalOffers: []
}

In cartItem you have to pass four properties as arrays of objects

  1. finalProducts: [],
  2. notFinalProducts: [],
  3. additionalOffers: [],
  4. unvalidatedProducts: []

finalProducts, notFinalProducts & unvalidatedProducts objects structure

{
    'contractNumber': '999999',
    'contractType': 'strom',
    'isFinal': true,
    'isSaved': true,
    'isValidated': true,
    'voiceFileRequired': true,
    'shippingAddress': {
      'address': {
        'streetName': 'Bonnstraße',
        'houseNumber': 999,
        'zip': 54125,
        'city': 'köln',
        'district': 'Köln süd'
      },
      'predefinedAddress': null,
      'status': null
    },
    'tariff': {
      'selectedProduct': {
        'tariff': 'Strom Zuhause+ (24 Monate)',
        'bonus': '50,00€'
      },
      'bonus': {},
      'usage': '5000',
      'info': {
        'bonus': '50,0€',
        'tariff': {
          'tariff': 'Strom+ (24 Monate)'
        }
      },
      'status': null
    },
    'specialPromotions': {
      'list': [],
      'selected': [],
      'info': null,
      'status': null
    },
    'additionalOffers': {
      'list': [],
      'selected': [],
      'status': null
    },
    'customerData': {
      'customer': {
        'salutation': '',
        'firstName': '',
        'lastName': '',
        'dateOfBirth': null,
        'company': null,
        'identicalAddress': false,
        'iban': 'DE12 3456 7890 0987 6543 21',
        'bic': '',
        'bank': '',
        'contactInformation': {
          'emailAddress': ''
        },
        'phone': '01574654132',
        'counterNumber': '123456',
        'startOfDelivery': '02.02.2018',
        'preSupplier': 'XXX AG',
        'phoneNumber': '01574654132'
      },
      'invoiceAddress': {
        'address': {
          'streetName': 'Südstraße',
          'houseNumber': 21,
          'zip': 15120,
          'city': 'Berlin',
          'district': 'Süd'
        },
        'predefinedAddress': null
      },
      'status': null
    }
}

additionalOffers object structure

    { title: 'offer 1: very good' }

Events

event namedescription
listItemChangedcalled if Checklist item clicked
deleteCartItemcalled if Cart item deleted
editCartItemcalled if Cart item edited

Infobox

Used as infobox with customer info. You can also pass your own content adding it to and setting showMainContent to false. If not, there will be shown predefined component with customer personal info & comments & optional infos.

To use predefined component you have to pass mainContent object.

  • in template
    <kmh-infobox
      v-if="showInfoBox"
      :titles="infoBoxTitles"
      :opened.sync="infoBoxOpened"
      :main-content="infoBoxContent"
      :show-main-content="true"
      @visibility-changed="infoboxVisibilitySet"
      @comment-added="addNewComment"
      @comment-changed="getNewValueOfComment"
    >
      <div slot="info">
        <div class="padding">
          test without main content
        </div>
      </div>
    </kmh-infobox>

Props

property namedescriptiontypeexample
titlespass title of pane in opened state and in closed (vertical title(in predefined content) or close title(in own content))Object{ titleOpen: 'subpanel title', titleClosed: 'subpanel closed', titleVertical: 'title vertical' }
openedshows/hides paneBooleantrue/false
mainContentpredefined content dataObjectsee below
showMainContentshow predefined content or your own content if falseBooleantrue/false

mainContent object

property namedescriptiontype
idNumber
personalcustomer infosObject
actionButtonicon and callback for actionFunction
othersarray of objects { title: 'contact', items: { name: 'phone', value: '123123'} to show below personal infosArray
commentsat bottom you can show comments for selected customer, check example belowArray
infosdata from infos will be rendered as cards with optional CTA callback passed to component, check example belowArray

mainContent object example

    {
        id: 234343,
        personal: {
          salutation: 'Herr',
          firstName: 'Peter',
          lastName: 'Pan',
          dateOfBirth: '28.03.1954',
          age: '54'
        },
        actionButton: {
          action: this.openSideBar,
          icon: 'edit'
        },
        others: [
          {
            title: 'Kundennummer',
            items: [{ name: '', value: '479340953' }]
          },
          {
            title: 'Addresse',
            items: [
              { name: '', value: 'Newstreet 34a' },
              { name: '', value: '45357 Essen' }
            ]
          },
          {
            title: 'Phone',
            items: [
              { name: '', value: '0049 34534 32342343' },
              { name: '', value: '0049 112 9976666' }
            ]
          },
          {
            title: 'Mail',
            items: [
              { name: 'privat', value: 'peter@pan.de' },
              { name: 'geschäftlich', value: 'pp@wonderland.com' }
            ]
          }
        ],
        comments: {
          isSaveButtonVisible: false,
          placeholder: 'Add new comment',
          tabs: [
            {
              label: 'Kampagne',
              entries: [
                {
                  author: 'Agent Tom',
                  campaign: 'Secret service',
                  created: '16.03.2018 19:34 Uhr',
                  text: 'Secret comment for user X.'
                },
                {
                  author: 'Agent Eva',
                  campaign: 'Winter Campaign',
                  created: '16.12.2017 22:22 Uhr',
                  text: 'Winter is comming.'
                }
              ]
            },
            {
              label: 'Alle',
              entries: [
                {
                  author: 'Agent Tom',
                  campaign: 'Secret service',
                  created: '16.03.2018 19:34 Uhr',
                  text: 'Secret comment for user X.'
                },
                {
                  author: 'Agent Bomba',
                  campaign: 'Campaign SSdfsdf',
                  created: '23.03.2018 14:34 Uhr',
                  text: 'Bomba & co.'
                }
              ]
            }
          ]
        },
        infos: [
          {
            icon: 'star',
            header: 'NBA (3534535435345)',
            text: 'Neuvertrag FN/BB',
            action: this.dummyAction
          },
          {
            icon: 'highlight',
            header: 'NBQ (3534535435345)',
            text: 'Opt-in einholen'
          }
        ]
      }

Events

event namedescription
visibilityChangedfired if pane collapsed/showed
commentAddedfired if new comment saved
commentChangedfired if comment was changed/edited

Infopanel (optional)

Used as infobox with additional info

    <kmh-infopanel-optional
      :opened.sync="infoPanelOpened"
      :titles="infoPanelTitles"
      @visibility-changed="infopanelVisibilitySet"
    >
      <div>
        test subpanel optional
      </div>
    </kmh-infopanel-optional>

Props

property namedescriptiontypeexample
titlespass title of pane in opened state and in closed (vertical title)Object{ titleOpen: 'subpanel title', titleClosed: 'subpanel closed' }
openedshows/hides paneBooleantrue/false

Events

event namedescription
visibilityChangedfired if pane collapsed/showed

Sidebar

Used as placeholder for additional components. You have to pass to sidebar component: path, type (name) and data for component you are injecting into.

  • in template
    <kmh-sidebar
      :sidebar.sync="sidebarPayload"
    >
      <div>
        My sidebar content
      </div>
    </kmh-sidebar>
  • payload example
    {
      show: false, //for toggling the sidebar
      closing: false, //default false; will only be used for the fading out animation
      blocked: false, //if true, then closing the sidebar is disabled
      title: '',
      props: {} // custom propertys
    }

Sidebar Props

property namedescriptiontype
sidebarsidebar payload. See the example aboveObject

Cart Popup Content

The Content from CartPopup inside the kmh-navigation-drawer component can be used as a single component outside an popup

  • in template
    <kmh-cart-popup-content
      :mini="true" // Default false
      :items="cartObject"
      @editCartItem="editCartItem"
      @deleteCartItem="deleteCartItem" />

Props

property namedescriptiontype
miniMini-Verison of the cart content (without tabs & actions). There will be shown only the unvalidated cart itemsBoolean
itemscart settings. It needs the same CartObject as in the NavigationObject, but without icon, title and actions. ExampleObject

Events

event namedescription
deleteCartItemcalled if Cart item deleted
editCartItemcalled if Cart item edited

Todos

  • Write MORE Tests
  • Expand documentation
0.17.38

1 year ago

0.17.39

1 year ago

0.17.32

1 year ago

0.17.31

1 year ago

0.17.34

1 year ago

0.17.33

1 year ago

0.17.36

1 year ago

0.17.35

1 year ago

0.17.37

1 year ago

0.17.23

2 years ago

0.17.25

2 years ago

0.17.24

2 years ago

0.17.27

2 years ago

0.17.26

2 years ago

0.17.29

2 years ago

0.17.28

2 years ago

0.17.30

2 years ago

0.17.16

2 years ago

0.17.15

2 years ago

0.17.18

2 years ago

0.17.17

2 years ago

0.17.19

2 years ago

0.17.21

2 years ago

0.17.20

2 years ago

0.17.22

2 years ago

0.17.4

2 years ago

0.17.5

2 years ago

0.17.6

2 years ago

0.17.7

2 years ago

0.17.8

2 years ago

0.17.9

2 years ago

0.17.10

2 years ago

0.17.12

2 years ago

0.17.11

2 years ago

0.17.14

2 years ago

0.17.13

2 years ago

0.16.28

2 years ago

0.17.2

2 years ago

0.17.3

2 years ago

0.17.0

2 years ago

0.17.1

2 years ago

0.16.26

3 years ago

0.16.27

3 years ago

0.16.25

3 years ago

0.16.23

3 years ago

0.16.24

3 years ago

0.16.22

3 years ago

0.16.19

3 years ago

0.16.21

3 years ago

0.16.20

3 years ago

0.16.18

3 years ago

0.16.17

3 years ago

0.16.16

3 years ago

0.16.14

3 years ago

0.16.15

3 years ago

0.16.12

3 years ago

0.16.13

3 years ago

0.16.11

3 years ago

0.16.10

4 years ago

0.16.8

4 years ago

0.16.9

4 years ago

0.16.7

4 years ago

0.16.6

4 years ago

0.16.5

4 years ago

0.16.4

4 years ago

0.16.3

4 years ago

0.16.2

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.15.1

4 years ago

0.15.2

4 years ago

0.15.3

4 years ago

0.14.8

4 years ago

0.14.6

4 years ago

0.14.7

4 years ago

0.14.5

4 years ago

0.14.4

4 years ago

0.14.3

4 years ago

0.14.1

4 years ago

0.14.2

4 years ago

0.14.0

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.1

4 years ago

0.8.81

4 years ago

0.9.0

4 years ago

0.8.79

4 years ago

0.8.78

4 years ago

0.8.77

4 years ago

0.8.76

4 years ago

0.8.75

4 years ago

0.8.74

4 years ago

0.8.73

5 years ago

0.8.72

5 years ago

0.8.71

5 years ago

0.8.70

5 years ago

0.8.69

5 years ago

0.8.68

5 years ago

0.8.67

5 years ago

0.8.66

5 years ago

0.8.65

5 years ago

0.8.64

5 years ago

0.8.63

5 years ago

0.8.62

5 years ago

0.8.61

5 years ago

0.8.60

5 years ago

0.8.59

5 years ago

0.8.58

5 years ago

0.8.57

5 years ago

0.8.56

5 years ago

0.8.55

5 years ago

0.8.54

5 years ago

0.8.53

5 years ago

0.8.52

5 years ago

0.8.51

5 years ago

0.8.49

5 years ago

0.8.48

5 years ago

0.8.47

5 years ago

0.8.46

5 years ago

0.8.45

5 years ago

0.8.44

5 years ago

0.8.43

5 years ago

0.8.42

5 years ago

0.8.41

5 years ago

0.8.40

5 years ago

0.8.39

5 years ago

0.8.38

5 years ago

0.8.37

5 years ago

0.8.36

5 years ago

0.8.35

5 years ago

0.8.34

5 years ago

0.8.33

5 years ago

0.8.32

5 years ago

0.8.30

5 years ago

0.8.29

5 years ago

0.8.28

5 years ago

0.8.27

5 years ago

0.8.26

5 years ago

0.8.25

5 years ago

0.8.24

5 years ago

0.8.23

5 years ago

0.8.22

5 years ago

0.8.21

5 years ago

0.8.20

5 years ago

0.8.19

5 years ago

0.8.18

5 years ago

0.8.17

5 years ago

0.8.16

5 years ago

0.8.15

5 years ago

0.8.14

5 years ago

0.8.13

5 years ago

0.8.12

5 years ago

0.8.10

5 years ago

0.8.9

5 years ago

0.8.8

5 years ago

0.8.7

5 years ago

0.8.6

5 years ago

0.8.5

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.7.14

5 years ago

0.7.13

5 years ago

0.7.12

5 years ago

0.7.11

5 years ago

0.7.10

5 years ago

0.7.9

5 years ago

0.7.8

5 years ago

0.7.7

5 years ago

0.7.6

5 years ago

0.7.5

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.9

5 years ago

0.4.5

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago