smart-webcomponents-react 14.0.0 → 14.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alertwindow/alertwindow.umd.js +1 -1
- package/combobox/combobox.d.ts +5 -0
- package/combobox/combobox.esm.js +12 -1
- package/combobox/combobox.umd.js +12 -1
- package/dialogwindow/dialogwindow.umd.js +1 -1
- package/grid/grid.d.ts +74 -38
- package/grid/grid.esm.js +60 -26
- package/grid/grid.umd.js +60 -26
- package/index.d.ts +99 -30
- package/kanban/kanban.d.ts +10 -0
- package/kanban/kanban.esm.js +23 -1
- package/kanban/kanban.umd.js +23 -1
- package/multilinewindow/multilinewindow.umd.js +1 -1
- package/package.json +1 -1
- package/progresswindow/progresswindow.umd.js +1 -1
- package/promptwindow/promptwindow.umd.js +1 -1
- package/source/modules/smart.accordion.js +1 -1
- package/source/modules/smart.array.js +2 -2
- package/source/modules/smart.barcode.js +1 -1
- package/source/modules/smart.breadcrumb.js +1 -1
- package/source/modules/smart.button.js +1 -1
- package/source/modules/smart.buttongroup.js +1 -1
- package/source/modules/smart.calendar.js +1 -1
- package/source/modules/smart.card.js +1 -1
- package/source/modules/smart.cardview.js +2 -2
- package/source/modules/smart.carousel.js +1 -1
- package/source/modules/smart.chart.js +2 -2
- package/source/modules/smart.checkbox.js +1 -1
- package/source/modules/smart.checkinput.js +1 -1
- package/source/modules/smart.chip.js +1 -1
- package/source/modules/smart.colorinput.js +1 -1
- package/source/modules/smart.colorpanel.js +1 -1
- package/source/modules/smart.colorpicker.js +1 -1
- package/source/modules/smart.combobox.js +2 -2
- package/source/modules/smart.common.js +2 -2
- package/source/modules/smart.countryinput.js +1 -1
- package/source/modules/smart.dateinput.js +2 -2
- package/source/modules/smart.daterangeinput.js +2 -2
- package/source/modules/smart.datetimepicker.js +1 -1
- package/source/modules/smart.dockinglayout.js +1 -1
- package/source/modules/smart.dropdownbutton.js +1 -1
- package/source/modules/smart.dropdownlist.js +1 -1
- package/source/modules/smart.editor.js +1 -1
- package/source/modules/smart.element.js +1 -1
- package/source/modules/smart.fileupload.js +1 -1
- package/source/modules/smart.form.js +1 -1
- package/source/modules/smart.formulaparser.js +1 -1
- package/source/modules/smart.ganttchart.js +4 -4
- package/source/modules/smart.gauge.js +1 -1
- package/source/modules/smart.grid.js +15 -15
- package/source/modules/smart.gridpanel.js +3 -3
- package/source/modules/smart.input.js +1 -1
- package/source/modules/smart.kanban.js +4 -4
- package/source/modules/smart.layout.js +1 -1
- package/source/modules/smart.led.js +1 -1
- package/source/modules/smart.listbox.js +1 -1
- package/source/modules/smart.listmenu.js +1 -1
- package/source/modules/smart.map.js +1 -1
- package/source/modules/smart.maskedtextbox.js +1 -1
- package/source/modules/smart.menu.js +1 -1
- package/source/modules/smart.multicomboinput.js +1 -1
- package/source/modules/smart.multiinput.js +1 -1
- package/source/modules/smart.multilinetextbox.js +2 -2
- package/source/modules/smart.multisplitbutton.js +1 -1
- package/source/modules/smart.numberinput.js +1 -1
- package/source/modules/smart.numerictextbox.js +2 -2
- package/source/modules/smart.pager.js +1 -1
- package/source/modules/smart.passwordinput.js +1 -1
- package/source/modules/smart.passwordtextbox.js +1 -1
- package/source/modules/smart.path.js +1 -1
- package/source/modules/smart.phoneinput.js +1 -1
- package/source/modules/smart.pivottable.js +4 -4
- package/source/modules/smart.progressbar.js +1 -1
- package/source/modules/smart.qrcode.js +1 -1
- package/source/modules/smart.querybuilder.js +2 -2
- package/source/modules/smart.radiobutton.js +1 -1
- package/source/modules/smart.rating.js +1 -1
- package/source/modules/smart.router.js +2 -2
- package/source/modules/smart.scheduler.js +2 -2
- package/source/modules/smart.scrollbar.js +1 -1
- package/source/modules/smart.slider.js +1 -1
- package/source/modules/smart.sortable.js +1 -1
- package/source/modules/smart.splitter.js +1 -1
- package/source/modules/smart.switchbutton.js +1 -1
- package/source/modules/smart.table.js +3 -3
- package/source/modules/smart.tabs.js +1 -1
- package/source/modules/smart.tank.js +1 -1
- package/source/modules/smart.textarea.js +1 -1
- package/source/modules/smart.textbox.js +2 -2
- package/source/modules/smart.timeinput.js +1 -1
- package/source/modules/smart.timepicker.js +1 -1
- package/source/modules/smart.toast.js +1 -1
- package/source/modules/smart.tooltip.js +1 -1
- package/source/modules/smart.tree.js +2 -2
- package/source/modules/smart.validator.js +1 -1
- package/source/modules/smart.window.js +2 -2
- package/source/smart.accordion.js +1 -1
- package/source/smart.ajax.js +1 -1
- package/source/smart.array.js +1 -1
- package/source/smart.barcode.js +1 -1
- package/source/smart.bootstrap.js +1 -1
- package/source/smart.breadcrumb.js +1 -1
- package/source/smart.button.js +1 -1
- package/source/smart.buttongroup.js +1 -1
- package/source/smart.calendar.js +1 -1
- package/source/smart.card.js +1 -1
- package/source/smart.cardview.js +1 -1
- package/source/smart.carousel.js +1 -1
- package/source/smart.chart.annotations.js +1 -1
- package/source/smart.chart.api.js +1 -1
- package/source/smart.chart.core.js +1 -1
- package/source/smart.chart.js +1 -1
- package/source/smart.chart.rangeselector.js +1 -1
- package/source/smart.chart.waterfall.js +1 -1
- package/source/smart.checkbox.js +1 -1
- package/source/smart.checkinput.js +1 -1
- package/source/smart.chip.js +1 -1
- package/source/smart.colorinput.js +1 -1
- package/source/smart.colorpanel.js +1 -1
- package/source/smart.colorpicker.js +1 -1
- package/source/smart.combobox.js +2 -2
- package/source/smart.complex.js +1 -1
- package/source/smart.core.js +1 -1
- package/source/smart.countryinput.js +1 -1
- package/source/smart.data.js +2 -2
- package/source/smart.date.js +1 -1
- package/source/smart.dateformatpanel.js +1 -1
- package/source/smart.dateinput.js +2 -2
- package/source/smart.daterangeinput.js +1 -1
- package/source/smart.datetimepicker.js +1 -1
- package/source/smart.dockinglayout.js +1 -1
- package/source/smart.draw.js +1 -1
- package/source/smart.dropdownbutton.js +1 -1
- package/source/smart.dropdownlist.js +1 -1
- package/source/smart.editor.js +1 -1
- package/source/smart.element.js +1 -1
- package/source/smart.elements.js +18 -18
- package/source/smart.export.js +1 -1
- package/source/smart.fileupload.js +1 -1
- package/source/smart.filter.js +1 -1
- package/source/smart.filterbuilder.js +1 -1
- package/source/smart.filterpanel.js +1 -1
- package/source/smart.form.js +1 -1
- package/source/smart.format.js +1 -1
- package/source/smart.formulaparser.js +1 -1
- package/source/smart.ganttchart.js +2 -2
- package/source/smart.gauge.js +1 -1
- package/source/smart.grid.cell.js +2 -2
- package/source/smart.grid.chart.js +1 -1
- package/source/smart.grid.column.js +2 -2
- package/source/smart.grid.core.js +2 -2
- package/source/smart.grid.dialog.js +2 -2
- package/source/smart.grid.edit.js +2 -2
- package/source/smart.grid.export.js +1 -1
- package/source/smart.grid.filter.js +2 -2
- package/source/smart.grid.group.js +1 -1
- package/source/smart.grid.js +1 -1
- package/source/smart.grid.menu.js +2 -2
- package/source/smart.grid.pager.js +1 -1
- package/source/smart.grid.reorder.js +1 -1
- package/source/smart.grid.resize.js +1 -1
- package/source/smart.grid.row.js +2 -2
- package/source/smart.grid.select.js +2 -2
- package/source/smart.grid.sort.js +1 -1
- package/source/smart.grid.toolbar.js +2 -2
- package/source/smart.grid.tree.js +1 -1
- package/source/smart.grid.view.js +2 -2
- package/source/smart.gridpanel.js +1 -1
- package/source/smart.input.js +1 -1
- package/source/smart.kanban.js +2 -2
- package/source/smart.layout.js +1 -1
- package/source/smart.led.js +1 -1
- package/source/smart.listbox.js +1 -1
- package/source/smart.listmenu.js +1 -1
- package/source/smart.map.js +1 -1
- package/source/smart.maskedtextbox.js +1 -1
- package/source/smart.math.js +1 -1
- package/source/smart.menu.js +1 -1
- package/source/smart.multicomboinput.js +1 -1
- package/source/smart.multiinput.js +1 -1
- package/source/smart.multilinetextbox.js +1 -1
- package/source/smart.multisplitbutton.js +1 -1
- package/source/smart.numberformatpanel.js +1 -1
- package/source/smart.numberinput.js +1 -1
- package/source/smart.numeric.js +1 -1
- package/source/smart.numerictextbox.js +1 -1
- package/source/smart.pager.js +1 -1
- package/source/smart.passwordinput.js +1 -1
- package/source/smart.passwordtextbox.js +1 -1
- package/source/smart.path.js +1 -1
- package/source/smart.phoneinput.js +1 -1
- package/source/smart.pivottable.js +1 -1
- package/source/smart.powerbutton.js +1 -1
- package/source/smart.progressbar.js +1 -1
- package/source/smart.qrcode.js +1 -1
- package/source/smart.radiobutton.js +1 -1
- package/source/smart.rating.js +1 -1
- package/source/smart.router.js +1 -1
- package/source/smart.scheduler.js +1 -1
- package/source/smart.scrollbar.js +1 -1
- package/source/smart.slider.js +1 -1
- package/source/smart.sortable.js +1 -1
- package/source/smart.splitter.js +1 -1
- package/source/smart.switchbutton.js +1 -1
- package/source/smart.table.js +2 -2
- package/source/smart.tabs.js +1 -1
- package/source/smart.tank.js +1 -1
- package/source/smart.textarea.js +1 -1
- package/source/smart.textbox.js +1 -1
- package/source/smart.tickintervalhandler.js +1 -1
- package/source/smart.timeinput.js +1 -1
- package/source/smart.timepicker.js +1 -1
- package/source/smart.toast.js +1 -1
- package/source/smart.tooltip.js +1 -1
- package/source/smart.tree.js +2 -2
- package/source/smart.validationpanel.js +1 -1
- package/source/smart.validator.js +1 -1
- package/source/smart.window.js +1 -1
- package/source/styles/components/smart.ganttchart.css +1 -1
- package/source/styles/components/smart.kanban.css +1 -1
- package/source/styles/components/smart.pivottable.css +1 -1
- package/source/styles/components/smart.table.css +1 -1
- package/source/styles/default/scss/smart.kanban.scss +20 -3
- package/source/styles/default/scss/smart.table.scss +22 -4
- package/source/styles/default/scss/textbox/_check-input.scss +1 -0
- package/source/styles/default/scss/textbox/_multi-combo-input.scss +1 -1
- package/source/styles/default/smart.kanban.css +17 -1
- package/source/styles/default/smart.table.css +30 -12
- package/source/styles/smart.default.css +2 -2
- package/source/typescript/smart.combobox.d.ts +5 -0
- package/source/typescript/smart.elements.d.ts +99 -30
- package/source/typescript/smart.grid.d.ts +77 -28
- package/source/typescript/smart.kanban.d.ts +10 -0
- package/source/typescript/smart.scheduler.d.ts +1 -1
- package/source/typescript/smart.table.d.ts +1 -1
- package/source/typescript/smart.tree.d.ts +5 -0
- package/table/table.d.ts +1 -1
- package/table/table.esm.js +1 -1
- package/table/table.umd.js +1 -1
- package/tabswindow/tabswindow.umd.js +1 -1
- package/tree/tree.d.ts +5 -0
- package/tree/tree.esm.js +12 -1
- package/tree/tree.umd.js +12 -1
- package/waitwindow/waitwindow.umd.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI v14.0.
|
|
2
|
+
/* Smart UI v14.0.34 (2022-05-09)
|
|
3
3
|
Copyright (c) 2011-2021 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_setupKanbanView(){const e=this,t=e._getStatusColumn("basic");e._createKanban(t),e._addDefaultKanbanColumns(t)}_addDefaultKanbanColumns(e){const t=this;e||(e=t._getStatusColumn("basic"));const a=t._getKanbanTaskFields(e);let l=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a._dataField){if(t.rows)for(let e=0;e<t.rows.length;e++){const l=t.rows[e];l.data[a._dataField]=l.data[a.dataField]}l.push(a)}}if(t.columnByDataField&&t.columnByDataField[e.dataField]){const a=t.columnByDataField[e.dataField];if(t.columnByDataField[e.dataField].dataField="taskStatusDefault",delete t.columnByDataField[e.dataField].displayField,delete t.columnByDataField[e.dataField],t.columnByDataField.taskStatusDefault=a,t.dataSource&&t.dataSource.length)for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e];a.taskStatusDefault=a.taskStatus,delete a.taskStatus}}a.forEach((e=>{(!t.columnByDataField||t.columnByDataField&&!t.columnByDataField[e.dataField])&&t.columns.push(e)})),l.forEach((e=>{const a=t.columns.indexOf(e);a>=0&&t.columns.splice(a,1)}))}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;const a=t._getStatusColumn(e);return t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}),t.beginUpdate(),t._createKanban(e),t._addDefaultKanbanColumns(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e?(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):e&&"basic"===e?(delete a._view,t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate()):void t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"uncategorized",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:"uncategorized"}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._getKanbanTaskFields(a).forEach((e=>{t.columns.push(e)})),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())}))}_showKanbanView(){const e=this;e.beginUpdate(),e.$.viewContent.classList.remove("smart-hidden"),e.$.content.classList.add("smart-hidden"),e._showAddNewRowButton("float"),e.$.viewContent.appendChild(e._kanban),e.classList.add("smart-kanban-view"),e._updateKanbanView(),e._kanban.refresh(),e._onFilter=e._onSort=()=>{"kanban"===e.view&&(e._updateKanbanView(),e._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e._kanban.localize("low"),value:"low"},{color:"#039BE5",label:e._kanban.localize("average"),value:"average"},{color:"#DD5347",label:e._kanban.localize("high"),value:"high"},{color:"#AF0020",label:e._kanban.localize("critical"),value:"critical"}]}_getKanbanTaskFields(e){const t=this,a=[],l=new Smart.Grid.Column({label:t._kanban.localize("startDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!1,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t._kanban.localize("startDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!1,_visible:!1,grid:t}),o=new Smart.Grid.Column({label:t._kanban.localize("dueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!1,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t._kanban.localize("dueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t}),n=new Smart.Grid.Column({label:t._kanban.localize("priority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!1,_visible:!1,allowDelete:!1,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t}),i=new Smart.Grid.Column({label:t._kanban.localize("tags"),dataField:"taskTags",allowDelete:!1,visible:!1,_visible:!1,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t}),s=new Smart.Grid.Column({label:t._kanban.localize("progress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!1,visible:!1,_visible:!1,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t}),r=new Smart.Grid.Column({label:t._kanban.localize("description"),dataField:"taskDescription",allowDelete:!1,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",visible:!0,grid:t}),d=new Smart.Grid.Column({label:t._kanban.localize("text"),allowDelete:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",visible:!0,grid:t}),u=new Smart.Grid.Column({label:t._kanban.localize("color"),allowDelete:!1,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!1,_visible:!1,grid:t}),c=new Smart.Grid.Column({label:t._kanban.localize("checklist"),dataField:"taskChecklist",showDescriptionButton:!0,allowSort:!1,allowDelete:!1,allowFilter:!1,visible:!1,_visible:!1,disabledDialogOptions:["allowFilter","allowSort"],formatFunction(e){if(e.value&&Array.isArray(e.value)){const a=e.value.filter((e=>e.completed)).length;e.value=t.localize("completed",{value:a})+"/"+e.value.length}else e.value=""},editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const n="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],i=[],s=l.firstElementChild;if(s.isInitialized&&(s.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,s.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),n){const e=n.map((e=>{const t={label:e.text,value:e.text};return e.completed&&i.push(t),t}));s.dataSource=e}else s.dataSource=[];s.selectedItems=i,!t.editing.editRow&&s.open&&s.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(s),a.push(n),a.push(i),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=new Smart.Grid.Column({label:t._kanban.localize("assignedTo"),allowDelete:!1,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!1,_visible:!1,template:"tags",grid:t});a.push(o),t._kanbanViewColumns=[l,o,s,n,i,c,u]}else t._kanbanViewColumns=[l,s,n,i,c,u];return a}getKanbanProperties(){const e=this;return e._kanbanProperties||(e._kanbanProperties={},e._kanbanProperties=Object.assign({},{taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",columnColorEntireSurface:!0,columnFooter:!0})),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;e||(e=t.columnByDataField.taskStatus);const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const n=t.getKanbanProperties();for(let e in n)a[e]=n[e];let i=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),i.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=i;let s=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;s.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,editor:a.editor.template});const l=s[s.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=s;const r=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const n=t.rowById[o];n&&(l.history=n.history,n.comments&&(l.comments=n.comments)),void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let t=a[e];if(e.startsWith("task")){let a=e.replace("task","");a=a.substring(0,1).toLowerCase()+a.substring(1),"progress"===a&&(t=100*parseFloat(t)),l[a]=t}else l[e]=t}l.id=a.$.id,r.push(l)}a.dataSource=r,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;for(let o=0;o<t.columns.length;o++){const n=t.columns[o].dataField;if(n.startsWith("task")){let t=n.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){a[n]=e.checklist;continue}if("history"===t&&(a[n]=e.history),void 0===e[t])continue;if("status"===t)a[n]=e[t];else if("priority"===t){const l=e[t];a[n]=l}else a[n]="progress"===t?parseFloat(e[t])/100:e[t]}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===n))&&(a[n]=e[n])}return a}_createKanban(e){const t=this;if(t._kanban)return;const a=document.createElement("smart-kanban");t._kanban=a,t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden")),t.onViewInit&&t.onViewInit(a),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const a=e.detail.value,l=t._getTaskData(a);t.updateRow(e.detail.id,l);const o=t.rowById[e.detail.id];o&&(o.history=a.history,o.comments=a.comments)}))}});
|
|
6
|
+
Smart.Utilities.Assign("Grid.View",class{createBasicKanban(){this._initKanbanView("basic")}createBlankKanban(){this._initKanbanView("blank")}_setupKanbanView(){const e=this;let t=e._getStatusColumn("basic"),a=[];e.columnByDataField||(e.columnByDataField=[]);for(let l=0;l<e.columns.length;l++){const o=e.columns[l];if(e.columnByDataField[o.dataField]||(e.columnByDataField[o.dataField]=o),"taskStatus"===o.dataField&&(t=o),o._dataField){if(e.rows)for(let t=0;t<e.rows.length;t++){const a=e.rows[t];a.data[o._dataField]=a.data[o.dataField]}a.push(o)}}0!==a.length&&(e._createKanban(t),e._addDefaultKanbanColumns(t))}_addDefaultKanbanColumns(e){const t=this;e||(e=t._getStatusColumn("basic"));const a=t._getKanbanTaskFields(e);let l=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a._dataField){if(t.rows)for(let e=0;e<t.rows.length;e++){const l=t.rows[e];l.data[a._dataField]=l.data[a.dataField]}l.push(a)}}let o=[],n=[];const i=t.isInitialized;t.isInitialized=!0,a.forEach((e=>{if(!t.columnByDataField||t.columnByDataField&&!t.columnByDataField[e.dataField])l.forEach((t=>{t._dataField===e.dataField&&(t.visible=!1,t._visible=!1)})),t.columns.push(e),o.push(t.columns.length-1),n.push(e);else if(t.columnByDataField&&t.columnByDataField[e.dataField]){const a=t.columnByDataField[e.dataField];a.editor=e.editor,a.formatFunction=e.formatFunction}})),void 0===t.columns.canNotify&&t.onColumnInserted&&t.onColumnInserted(o,n),t.isInitialized=i}_getStatusColumn(e){const t=this;return new Smart.Grid.Column({label:!e||e&&"blank"===e?t.localize("dialogNewColumn"):t.localize("status"),description:t.localize("dialogAddColumnStatusDescription"),dataField:"taskStatus",showDescriptionButton:!0,dataType:"string",defaultValue:"",editor:{template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""},{color:"#33B679",label:t.localize("toDo"),value:"toDo"},{color:"#039BE5",label:t.localize("inProgress"),value:"inProgress"},{color:"#8E24AA",label:t.localize("done"),value:"done"}]},template:"tags",cellsAlign:"left",align:"left",grid:t,_view:!0})}_initKanbanView(e){const t=this;if(t._kanbanInitialized)return;t._kanbanInitialized=!0;const a=t._getStatusColumn(e);if(t._onColumnUpdated=(e,a)=>{e._view&&(delete e._view,delete t._onColumnUpdated,e.allowSort=e.allowEdit=e.allowFilter=!0,"blank"===a.kanban&&(e.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"",singleSelect:!0,dataSource:[{color:"#DD5347",label:"",value:""}]}),t.beginUpdate(),t._createKanban(e),t._addDefaultKanbanColumns(e),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())},e&&"blank"===e)return delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:[]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label="New Column",t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(e&&"basic"===e)return delete a._view,t.beginUpdate(),t._createKanban(a),t._addDefaultKanbanColumns(a),t._resetCachedLayout(),t._refreshHeaderBar(),void t.endUpdate();if(t._kanbanViewColumns){let e=!1;if(t._kanbanViewColumns.forEach((a=>{if(!t.columnByDataField[a.dataField])return e=!0,!0})),!e)return void t._showKanbanView()}t._openAddColumnDialog(a,!0,(e=>{!1===e&&(delete a._view,a.editor={template:"multiComboInput",readonly:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,defaultValue:"uncategorized",singleSelect:!0,dataSource:[{color:"#DD5347",label:t.localize("uncategorized"),value:"uncategorized"}]},a.allowSort=a.allowEdit=a.allowFilter=!0,a.label=t.localize("dialogNewColumn"),t.beginUpdate(),t._createKanban(a),t._getKanbanTaskFields(a).forEach((e=>{t.columns.push(e)})),t._refreshHeaderBar(),t.endUpdate(!1),t._showKanbanView())}))}_showKanbanView(){const e=this;e.beginUpdate(),e.$.viewContent.classList.remove("smart-hidden"),e.$.content.classList.add("smart-hidden"),e._showAddNewRowButton("float"),e.$.viewContent.appendChild(e._kanban),e.classList.add("smart-kanban-view"),e._updateKanbanView(),e._kanban.refresh(),e._onFilter=e._onSort=()=>{"kanban"===e.view&&(e._updateKanbanView(),e._kanban.refresh())}}_hideKanbanView(){const e=this;e.classList.contains("smart-kanban-view")&&(e.$.viewContent.classList.add("smart-hidden"),e.$.content.classList.remove("smart-hidden"),e._kanban.remove(),e.classList.remove("smart-kanban-view"),e._resetCachedLayout(),e.dataSource.boundHierarchy&&(e.dataSource.refreshHierarchy(),e._refreshRowHierarchy(!0,!0)),e.endUpdate(),e.dataSource.boundHierarchy&&e._recycle())}_getPriorityDataSource(){const e=this;return[{color:"#33B679",label:e._kanban.localize("low"),value:"low"},{color:"#039BE5",label:e._kanban.localize("average"),value:"average"},{color:"#DD5347",label:e._kanban.localize("high"),value:"high"},{color:"#AF0020",label:e._kanban.localize("critical"),value:"critical"}]}_getKanbanTaskFields(e){const t=this,a=[],l=new Smart.Grid.Column({label:t._kanban.localize("startDate"),dataField:"taskStartDate",cellsFormat:"d",showDescriptionButton:!0,dataType:"date",allowDelete:!1,editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e>a.taskDueDate&&a.taskDueDate&&e)||t.localize("invalidMaxValue",{value:t._kanban.localize("startDate"),max:a.taskDueDate.toLocaleDateString()})},visible:!1,grid:t}),o=new Smart.Grid.Column({label:t._kanban.localize("dueDate"),dataField:"taskDueDate",cellsFormat:"d",showDescriptionButton:!0,allowDelete:!1,dataType:"date",editor:{template:"dateInput",autoOpen:!0,onValidate:(e,a)=>!(e<a.taskStartDate&&a.taskStartDate&&e)||t.localize("invalidMinValue",{value:t._kanban.localize("dueDate"),min:a.taskStartDate.toLocaleDateString()})},visible:!0,_visible:!0,grid:t}),n=new Smart.Grid.Column({label:t._kanban.localize("priority"),dataField:"taskPriority",showDescriptionButton:!0,dataType:"string",visible:!1,allowDelete:!1,defaultValue:"average",disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,allowEmptyItem:!1,disabledDialogOptions:!0,dropDownButtonPosition:"right",colorItems:!0,autoOpen:!0,pills:!0,singleSelect:!0,dataSource:t._getPriorityDataSource()},template:"tags",grid:t}),i=new Smart.Grid.Column({label:t._kanban.localize("tags"),dataField:"taskTags",allowDelete:!1,allowGroup:!1,visible:!1,showDescriptionButton:!0,dataType:"string",template:"tags",grid:t}),s=new Smart.Grid.Column({label:t._kanban.localize("progress"),dataField:"taskProgress",showDescriptionButton:!0,allowDelete:!1,visible:!1,disabledDialogOptions:["numberFormat","minValue","maxValue"],dataType:"number",cellsFormat:"p0",template:"progress",editor:{disabledDialogOptions:!0,template:"numberInput",min:0,max:1},grid:t}),r=new Smart.Grid.Column({label:t._kanban.localize("description"),dataField:"taskDescription",allowGroup:!1,allowDelete:!1,showDescriptionButton:!0,editor:{template:"textarea"},dataType:"string",visible:!0,grid:t}),d=new Smart.Grid.Column({label:t._kanban.localize("text"),allowDelete:!1,allowGroup:!1,dataField:"taskText",showDescriptionButton:!0,dataType:"string",visible:!0,grid:t}),u=new Smart.Grid.Column({label:t._kanban.localize("color"),allowDelete:!1,dataField:"taskColor",showDescriptionButton:!0,dataType:"string",editor:{template:"colorInput"},template:"color",width:60,visible:!1,grid:t}),c=new Smart.Grid.Column({label:t._kanban.localize("checklist"),dataField:"taskChecklist",allowGroup:!1,showDescriptionButton:!0,allowSort:!1,allowDelete:!1,allowFilter:!1,visible:!1,disabledDialogOptions:["allowFilter","allowSort"],formatFunction(e){if(e.value&&e.value.indexOf("[")>=0&&(e.value=JSON.parse(e.value)),e.value&&Array.isArray(e.value)&&e.value.length>0){const a=e.value.filter((e=>e.completed)).length;e.value=t.localize("completed",{value:a})+"/"+e.value.length}else e.value=""},editor:{template:"<smart-multi-combo-input></smart-multi-combo-input>",settings:{inputTagsMode:"one",readonly:!0,allowItemsAdd:!0,allowItemsRemove:!0},onRender:function(e,a,l,o){const n="string"==typeof o[a]&&o[a]?JSON.parse(o[a]):o[a],i=[],s=l.firstElementChild;if(s.isInitialized&&(s.messages[t.locale].tagLabel=t._kanban.messages[t.locale].taskCompleted,s.messages[t.locale].tagLabelOne=t._kanban.messages[t.locale].taskCompleted),n){const e=n.map((e=>{const t={label:e.text,value:e.text};return e.completed&&i.push(t),t}));s.dataSource=e}else s.dataSource=[];s.selectedItems=i,!t.editing.editRow&&s.open&&s.open()},setValue:function(){},getValue:function(){const e=this.firstElementChild;return e.dataSource.map((t=>{const a=e.selectedItems.find((e=>t.value===e.value));return{text:t.label,completed:void 0!==a}}))}},dataType:"any",grid:t});let m=!0;for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.editor&&a.editor.collaborator){m=!1;break}}if(a.push(d),a.push(r),a.push(e),a.push(l),a.push(o),a.push(s),a.push(n),a.push(i),a.push(c),a.push(u),m){let e=[""];for(let a=0;a<t.users.length;a++)e.push({label:t.users[a].name,value:t.users[a].id,id:t.users[a].id,image:t.users[a].image,color:t.users[a].color||""});const o=new Smart.Grid.Column({label:t._kanban.localize("assignedTo"),allowDelete:!1,dataField:"taskUserId",showDescriptionButton:!0,disabledDialogOptions:["allowColorItems","options"],editor:{template:"multiComboInput",readonly:!0,collaborator:!0,disabledDialogOptions:!0,colorItems:!0,dropDownButtonPosition:"right",autoOpen:!0,pills:!0,singleSelect:!0,dataSource:e},dataType:"string",visible:!1,template:"tags",grid:t});a.push(o),t._kanbanViewColumns=[l,o,s,n,i,c,u]}else t._kanbanViewColumns=[l,s,n,i,c,u];return a}getKanbanProperties(){const e=this;return e._kanbanProperties||(e._kanbanProperties={},e._kanbanProperties=Object.assign({},{taskColorEntireSurface:!1,collapsible:!0,addNewButton:!0,addNewButtonDisplayMode:"both",addNewColumn:!0,allowColumnRemove:!0,editable:!0,columnActions:!0,columnEditMode:"headerAndMenu",allowColumnEdit:!0,allowColumnReorder:!0,taskActions:!0,taskDue:!0,autoColumnHeight:!0,columnWidth:275,taskComments:!0,taskProgress:!0,columnSummary:!0,columnColors:!0,taskPriority:!0,taskUserIcon:!0,taskSubTasks:"none",columnColorEntireSurface:!0,columnFooter:!0})),e._kanbanProperties}setKanbanProperties(e){const t=this,a=t.getKanbanProperties();for(let t in e)void 0!==e[t]&&void 0!==a[t]&&(a[t]=e[t]);t._kanbanProperties=a,t.classList.contains("smart-kanban-view")&&(t._updateKanbanView(),t._kanban.refresh())}_updateKanbanView(e){const t=this;if(!t._kanban)return;if(!t.isInitialized)return;e||(e=t.columnByDataField.taskStatus);const a=t._kanban,l=a.context;a.context=a;const o=e.editor.dataSource&&e.editor.dataSource.length>0?e.editor.dataSource:[{label:e.label,value:e.value,color:"#DD5347"}];a.users=t.users,a.currentUser=t.currentUser;const n=t.getKanbanProperties();for(let e in n)a[e]=n[e];let i=[];for(let e=0;e<o.length;e++){const a=o[e];let l=a.label;""===a.label&&(l=a.labelAlt?a.labelAlt:t.localize("uncategorized")),i.push({label:l,value:a.value,status:a.value,dataField:a.value,color:a.color})}a.columns=i;let s=[];for(let e=0;e<t.columns.length;e++){const a=t.columns[e];if(a.dataField.startsWith("task"))continue;if(a._dataField)continue;if(!1===a.allowEdit)continue;s.push({label:a.label||"",dataField:a.dataField,dataType:a.dataType,editor:a.editor.template});const l=s[s.length-1];a.editor.dataSource&&(l.dataSource=[...a.editor.dataSource]),a.editor.colorItems&&(l.colorItems=a.editor.colorItems),a.editor.colorItems&&(l.pills=a.editor.pills),a.editor.colorItems&&(l.singleSelect=a.editor.singleSelect),a.editor.dropDownButtonPosition&&(l.dropDownButtonPosition=a.editor.dropDownButtonPosition),["min","max","minLength","maxLength","minDate","maxDate"].forEach((e=>{void 0!==a.editor[e]&&(l[e]=a.editor[e])}))}a.taskCustomFields=s;const r=[];for(let e=0;e<t.dataSource.length;e++){const a=t.dataSource[e],l={},o=a.$.id;if(!1===a.$.filtered)continue;const n=t.rowById[o];n&&(l.history=n.history,n.comments&&(l.comments=n.comments)),void 0===a.taskStatus&&(a.taskStatus="");for(let e in a){if(e.startsWith("$"))continue;let t=a[e];if(e.startsWith("task")){let a=e.replace("task","");a=a.substring(0,1).toLowerCase()+a.substring(1),"progress"===a&&(t=100*parseFloat(t)),"checklist"===a&&(t=t.length?JSON.parse(t):[]),l[a]=t}else l[e]=t}l.id=a.$.id,r.push(l)}a.dataSource=r,a.context=l}_getTaskData(e){const t=this,a={},l=t._kanban;for(let o=0;o<t.columns.length;o++){const n=t.columns[o].dataField;if(n.startsWith("task")){let t=n.replace("task","");if(t=t.substring(0,1).toLowerCase()+t.substring(1),"checklist"===t){a[n]=e.checklist;continue}if("history"===t&&(a[n]=e.history),void 0===e[t])continue;if("status"===t)a[n]=e[t];else if("priority"===t){const l=e[t];a[n]=l}else a[n]="progress"===t?parseFloat(e[t])/100:e[t]}else l.taskCustomFields&&l.taskCustomFields.length&&l.taskCustomFields.find((e=>e.dataField===n))&&(a[n]=e[n])}return a}_createKanban(e){const t=this;if(t._kanban)return;const a=document.createElement("smart-kanban");t._kanban=a,t._updateKanbanView(e),a.style.width="100%",a.style.height="100%",a.style.borderTopColor="transparent",a.style.borderLeftColor="transparent",a.style.borderRightColor="transparent",a.style.borderBottomColor="transparent",a.style.background="inherit","kanban"===t.view&&(t.$.viewContent.classList.remove("smart-hidden"),t.$.content.classList.add("smart-hidden")),t.onViewInit&&t.onViewInit(a),t.$.viewContent.appendChild(a),"kanban"===t.view&&t.classList.add("smart-kanban-view"),t.editing.addNewColumn._addButton&&t.editing.addNewColumn._addButton.classList.remove("show");const l=()=>{const e=this,t=e.columnByDataField.taskStatus,a=e._kanban,l=[];for(let e=0;e<a.columns.length;e++){const t=a.columns[e],o={label:t.dataField?t.label:"",labelAlt:t.label,value:t.dataField,color:t.color};l.push(o)}if(t.editor.isDirty=!0,t.editor.dataSource=l,t._state&&(t._state.editor=t.editor),delete t.editor._items,e.onColumnUpdated){const a=e.viewColumns.indexOf(t);e.onColumnUpdated(a,t)}};a.addEventListener("columnUpdate",(()=>{l()})),a.addEventListener("columnAdd",(()=>{l()})),a.addEventListener("columnRemove",(()=>{l()})),a.addEventListener("taskAdd",(e=>{const a=e.detail.value,l=t._getTaskData(a);t._onRowInserted=e=>{a.id=e.id},t.addRow(l,!0,(e=>{a.id=e.id})),t._refreshHeaderBar(),delete t._onRowInserted})),a.addEventListener("taskRemove",(e=>{t.removeRow(e.detail.id),t._refreshHeaderBar()})),a.addEventListener("taskUpdate",(e=>{const a=e.detail.value,l=t._getTaskData(a);t.updateRow(e.detail.id,l);const o=t.rowById[e.detail.id];o&&(o.history=a.history,o.comments=a.comments,t.onComment&&t.onComment(e.detail.id,o.comments))}))}});
|
package/source/smart.input.js
CHANGED