Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/demo/src/config.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ angular.module('app')
stateHelperProvider.state(freshRouterStates)

stateHelperInit(freshMenu)
console.log("freshMenu", freshMenu)
appState.sideMenuConfig = freshMenu

// $stateProvider.state({
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/pages/batchList/edit/editCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseEditCtrl from 'angle-grinder/src/ng/gridz/list/BaseEditCtrl'
// import appState from 'angle-grinder/src/tools/AppState'
import _ from 'lodash'
import appConfigApi from 'angle-grinder/src/dataApi/AppConfigApi'
import appConfigApi from '@yakit/core/stores/AppConfigApi'

export default class EditCtrl extends BaseEditCtrl {
vm = {}
Expand Down
2 changes: 2 additions & 0 deletions examples/demo/src/svelteDataList/customer/RestGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@

<p>dataApi is {dataApi.key}</p>
<p>foo is {foo}</p>
<a href="/foo" class="link nav">WTF</a>
<a href="https://www.google.com/" class="link nav">google</a>

<Gridz {dataApi} {ctx}/>
41 changes: 41 additions & 0 deletions examples/demo/src/svelteDataList/simple/QuickFilter.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
Wraps the jqGrid and adds the toolbar and search form
-->
<script>
import {ButtonToggleGroup} from '@yakit/svelte/index'

let activeKey
let activeState

let schema = [
{ key: 'PA', label: 'Payments'},
{ key: 'IN', label: 'Invoices'},
{ key: 'MEM', label: 'Memos'}
]

let states = [
{ key: '0', label: 'Open'},
{ key: '1', label: 'Closed'}
]

function onToggle(event){
let item = event.detail
console.log("onToggle", item)
console.log("activeKey/activeState", activeKey, activeState)
}

</script>

<div class='quick-filter'>
<ButtonToggleGroup bind:activeKey {schema} on:click={onToggle}/>
</div>
<div class='quick-filter'>
<ButtonToggleGroup bind:activeKey={activeState} schema={states} on:click={onToggle}/>
</div>

<style>
.quick-filter :global(.button7) {
height: 30px;
text-transform:initial;
}
</style>
8 changes: 5 additions & 3 deletions examples/demo/src/svelteDataList/simple/SimpleGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<script>
import { Gridz } from '@yakit/svelte/index'
import sessionStores from '~/store/sessionServices'
import QuickFilter from './QuickFilter.svelte'

let gridOptions = {
colModel: [
Expand Down Expand Up @@ -52,7 +53,8 @@
},
state:{
input: 'select',
selectOptions:{
options:{
isMulti: false,
isValueObject: true,
data:[{id:0, name: 'Open'}, {id:1, name: 'Closed'}]
}
Expand All @@ -61,7 +63,7 @@
column3:{
customer:{
input: 'select',
selectOptions:{
options:{
dataApi:{
key:'customer'
}
Expand All @@ -80,5 +82,5 @@

</script>

<Gridz {dataApi} {ctx} />
<Gridz {dataApi} {ctx} {QuickFilter}/>
<!-- <JqGrid {ctx}/> -->
60 changes: 0 additions & 60 deletions src/dataApi/AppConfigApi.js

This file was deleted.

14 changes: 8 additions & 6 deletions src/gridz/GridDataApiCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ export default class GridDataApiCtrl {
return this.jqGridEl.jqGrid('resetSelection')
}

selectRow(selRowId) {
this.clearSelection()
return this.jqGridEl.jqGrid('setSelection', selRowId)
}

// Returns an array with data of the requested id = rowid.
// The returned array is of type name:value, where the name is
// a name from colModel and the value from the associated column in that row.
Expand All @@ -184,9 +189,7 @@ export default class GridDataApiCtrl {
}

updateFooter(data) {
setTimeout(_ => {
this.getGridEl().footerData('set', data)
})
if(this.jqGridEl) this.jqGridEl.footerData('set', data)
}

// Populates the grid with the given data.
Expand Down Expand Up @@ -316,7 +319,7 @@ export default class GridDataApiCtrl {
// The syntax of data array is: {name1:value1,name2: value2...}
// where the name is the name of the column as described in the colModel
// and the value is the new value.
updateRow(id, data, emptyMissingCells) {
updateRow(id, data, emptyMissingCells = false) {
if (emptyMissingCells == null) { emptyMissingCells = true }
const flatData = flattenObject(data)

Expand Down Expand Up @@ -422,7 +425,7 @@ export default class GridDataApiCtrl {
return this.reload()
}

saveRow(id, data) {
addOrUpdateRow(id, data) {
if (this.hasRow(id)) {
return this.updateRow(id, data)
} else {
Expand Down Expand Up @@ -518,7 +521,6 @@ export default class GridDataApiCtrl {
if(!_.isEmpty(q)){
p.q = q
}
Log.debug("gridLoader search " + this.dataApi.key, p)
const data = await this.dataApi.search(p)
// this.addJSONData(data)
} catch (er) {
Expand Down
3 changes: 1 addition & 2 deletions src/gridz/jq.formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ $.extend($.fn.fmatter, {
/** for the Svelte popovers */
editPopoverLink(cellVal, options, rowdata) {
// console.log("editPopoverLink", cellVal, options, rowdata)
if (!cellVal) return ''
const ident = rowdata['id']
const popoverId = `#${options.gid}-popover-edit`
return `<a class="editPopoverLink popover-open" href="#" data-id="${ident}" data-popover="${popoverId}">${cellVal}</a>`
},

gridLink(cellVal, options, rowdata) {
Log.debug("gridLink options", options)
Log.debug("gridLink rowdata", rowdata)
const id = rowdata.id
return `<a class="gridLink" href="#" >${cellVal}</a>`
},
Expand Down
18 changes: 14 additions & 4 deletions src/gridz/makeListDataCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// import _ from 'lodash'
import { get, writable } from 'svelte/store';
import { isEmpty, cloneDeep, isFunction, merge } from '@yakit/core/dash'
import appConfigApi from '../dataApi/AppConfigApi'
import appConfigApi from '@yakit/core/stores/AppConfigApi'
import toast from '@yakit/ui/growl'
import Swal from '@yakit/ui/swal'

Expand All @@ -13,7 +13,7 @@ const makeListDataCtrl = (opts) => {
let defaultToolbarOpts = {
selectedButtons: {
bulkUpdate: { icon: 'edit_note', tooltip: 'Bulk Update' },
xlsExport: { icon: 'mdi-microsoft-excel', tooltip: 'Export to Excel' }
xlsExport: { icon: 'view_module', label: 'Export to Excel' }
},
leftButtons: {
create: { icon: 'add_box', tooltip: 'Create New' }
Expand Down Expand Up @@ -62,12 +62,16 @@ const makeListDataCtrl = (opts) => {
//if ctx toolbar option were passed in with context
if(ctx.toolbarOptions) merge(tbopts, ctx.toolbarOptions)
// setup search form show based on if searchForm is configured
if (ctx.searchForm === undefined) {
if (ctx.searchForm === undefined || gopts.searchFormEnabled == false) {
gopts.showSearchForm = false
ctx.state.showSearchForm = false
tbopts.searchFormButton.class = 'hidden'
}

if (ctx.editForm === undefined || gopts.createEnabled == false) {
tbopts.leftButtons.create.class = 'hidden'
}

if (ctx.bulkUpdateForm === undefined) {
tbopts.selectedButtons.bulkUpdate.class = 'hidden'
}
Expand Down Expand Up @@ -112,7 +116,9 @@ const makeListDataCtrl = (opts) => {
}
},

// Fires for common actions, will fall back to ctx.toobarHandler if nothing exists
fireToolbarAction(btnItem, event) {
console.log("listDataCtrl fireToolbarAction", btnItem, event)
switch (btnItem.key) {
case 'create':
return ctrl.create()
Expand All @@ -123,7 +129,11 @@ const makeListDataCtrl = (opts) => {
case 'delete':
return ctrl.deleteSelected()
default:
if (isFunction(ctrl[btnItem.key])) {
if(ctrl.ctx.toolbarHandler){
return ctrl.ctx.toolbarHandler(btnItem, event)
}
//FIXME this is kind of dangerous and should be removes and use ctx.toolbarHandler
else if (isFunction(ctrl[btnItem.key])) {
return ctrl[btnItem.key](btnItem, event)
}
}
Expand Down
19 changes: 0 additions & 19 deletions src/ng/common/directives/empty-links.js

This file was deleted.

1 change: 0 additions & 1 deletion src/ng/common/directives/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ import './sideMenu'
import './tagInput'
import './perfect-scrollbar'
import './maxlength'
import './empty-links'
import './letter-icon'
2 changes: 1 addition & 1 deletion src/ng/gridz/list-ds/ListDataApiCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isEmpty } from '@yakit/core/dash'
import EditModalCtrl from './EditModalCtrl'
import BulkUpdateModalCtrl from './BulkUpdateModalCtrl'
import { argsMerge } from '../../utils/classUtils'
import appConfigApi from '../../../dataApi/AppConfigApi'
import appConfigApi from '@yakit/core/stores/AppConfigApi'
import toast from '@yakit/ui/growl'
//import Swal from '../../../tools/swal'

Expand Down
2 changes: 1 addition & 1 deletion src/ng/gridz/list-ds/makeNgListDataCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const makeNgListDataCtrl = (ctrl) => {
)
modInst.result
.then(editedVm => {
isUpdate ? ctrl.getGridCtrl().updateRow(editedVm.id, editedVm) : ctrl.getGridCtrl().addRow(editedVm.id, editedVm)
isUpdate ? ctrl.getGridCtrl().addOrUpdateRow(editedVm.id, editedVm) : ctrl.getGridCtrl().addRow(editedVm.id, editedVm)
})
.catch(() => {
console.log('Modal dismissed at: ' + new Date())
Expand Down
2 changes: 1 addition & 1 deletion src/ng/gridz/list/BaseEditCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import _ from 'lodash'

import { argsMerge } from '../../utils/classUtils'
import appConfigApi from '../../../dataApi/AppConfigApi'
import appConfigApi from '@yakit/core/stores/AppConfigApi'
import _ from 'lodash'

export default class EditModalCtrl {
Expand Down
2 changes: 1 addition & 1 deletion src/ng/gridz/list/BaseListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'lodash'
import EditModalCtrl from './EditModalCtrl'
import BulkUpdateModalCtrl from './BulkUpdateModalCtrl'
import { argsMerge } from '../../utils/classUtils'
import appConfigApi from '../../../dataApi/AppConfigApi'
import appConfigApi from '@yakit/core/stores/AppConfigApi'
import toast from '@yakit/ui/growl'
// import { transformOptions } from '../../controls/formly/helpers'

Expand Down
2 changes: 1 addition & 1 deletion src/ng/sidenav/ag-sidenav.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="sidenav-nav sidenav-list">

<script type="text/ng-template" id="menuItemTree">
<a href="{{$ctrl.hasChildren(mitem) ? '' : (mitem.children ? mitem.children[0].name : mitem.name)}}" class="item-content"
<a href="{{$ctrl.hasChildren(mitem) ? '' : mitem.href}}" class="item-content nav"
ng-click="$ctrl.itemClick(mitem, $event)">
<span class="icon" ng-if="mitem.data.icon">
<i class="{{mitem.data.icon}}"></i>
Expand Down
2 changes: 1 addition & 1 deletion src/ng/sidenav/ag-sidenav.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class controller {
// it has no children, its a ui-router link
// if not fixed then close (minimize) on click
if (!this.isFixed) minimizeSidenav()
appState.$state.go(mitem.children ? mitem.children[0].name : mitem.name)
// appState.$state.go(mitem.children ? mitem.children[0].name : mitem.name)
}
}
}
Expand Down
Loading