From c95a6bec9690965f51055afadb3beb9d9af66ffe Mon Sep 17 00:00:00 2001 From: minjk-bl Date: Mon, 25 Sep 2023 16:34:11 +0900 Subject: [PATCH] Edit to_datetime ui and functions on Frame app --- visualpython/css/m_apps/frame.css | 4 +- visualpython/js/m_apps/Frame.js | 66 +++++++++++++++---------------- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/visualpython/css/m_apps/frame.css b/visualpython/css/m_apps/frame.css index 8661f4af..360fbadb 100644 --- a/visualpython/css/m_apps/frame.css +++ b/visualpython/css/m_apps/frame.css @@ -170,8 +170,10 @@ /* background: rgba(66, 165, 245, 0.2); */ } .vp-fe-table-column-isnumeric { - float: left; margin-right: 5px; + vertical-align: middle; + height: 15px; + line-height: 15px; } /* Row Hover */ diff --git a/visualpython/js/m_apps/Frame.js b/visualpython/js/m_apps/Frame.js index 6452ddf6..438dfc79 100644 --- a/visualpython/js/m_apps/Frame.js +++ b/visualpython/js/m_apps/Frame.js @@ -88,7 +88,7 @@ define([ { id: 'delete', label: 'Delete', selection: FRAME_SELECT_TYPE.MULTI, menuType: FRAME_EDIT_TYPE.DROP }, { id: 'rename', label: 'Rename', selection: FRAME_SELECT_TYPE.NONE, menuType: FRAME_EDIT_TYPE.RENAME }, { id: 'as_type', label: 'As type', selection: FRAME_SELECT_TYPE.NONE, axis: FRAME_AXIS.COLUMN, menuType: FRAME_EDIT_TYPE.AS_TYPE }, - { id: 'to_datetime', label: 'To datetime', selection: FRAME_SELECT_TYPE.SINGLE, axis: FRAME_AXIS.COLUMN, menuType: FRAME_EDIT_TYPE.TO_DATETIME }, + { id: 'to_datetime', label: 'To Datetime', selection: FRAME_SELECT_TYPE.SINGLE, axis: FRAME_AXIS.COLUMN, menuType: FRAME_EDIT_TYPE.TO_DATETIME }, { id: 'replace', label: 'Replace', selection: FRAME_SELECT_TYPE.SINGLE, axis: FRAME_AXIS.COLUMN, menuType: FRAME_EDIT_TYPE.REPLACE }, { id: 'discretize', label: 'Discretize', selection: FRAME_SELECT_TYPE.SINGLE, axis: FRAME_AXIS.COLUMN, numeric_only: true, menuType: FRAME_EDIT_TYPE.DISCRETIZE } ] @@ -724,6 +724,10 @@ define([ $(this.wrapSelector('.vp-inner-popup-fillvalue')).focus(); return; } + } else if (type === FRAME_EDIT_TYPE.TO_DATETIME) { + if (content.newcol === '') { + $(this.wrapSelector('.vp-inner-popup-todt-new-col')).focus(); + } } // run check modules for outliers and load codes if (type === FRAME_EDIT_TYPE.FILL_OUT) { @@ -1126,16 +1130,6 @@ define([ } }); - // bind event for checking add column - $(this.wrapSelector('.vp-inner-popup-todt-use-addcol')).on('change', function() { - let checked = $(this).prop('checked'); - if (checked === true) { - $(that.wrapSelector('.vp-inner-popup-todt-addcol-box')).show(); - } else { - $(that.wrapSelector('.vp-inner-popup-todt-addcol-box')).hide(); - } - }); - // Add column set event $(this.wrapSelector('.vp-inner-popup-todt-addcol')).on('click', function() { let dateTypeList = [ // df[col].dt[{dateType}] @@ -1159,7 +1153,7 @@ define([ }); let addColItemTag = $(`
- + @@ -1167,6 +1161,13 @@ define([
`); $(that.wrapSelector('.vp-inner-popup-todt-addcol-content')).append(addColItemTag); $(addColItemTag)[0].scrollIntoView(); + + // bind event for selecting date type option + $(that.wrapSelector('.vp-inner-popup-todt-addcol-type')).off('change'); + $(that.wrapSelector('.vp-inner-popup-todt-addcol-type')).on('change', function() { + let dateTypeVal = $(this).val(); + $(this).parent().find('.vp-inner-popup-todt-addcol-colname').val(dateTypeVal); + }); // bind event for deleting $(that.wrapSelector('.vp-inner-popup-todt-addcol-del')).off('click'); @@ -2186,15 +2187,15 @@ define([ var content = new com_String(); let formatList = [ { label: 'Auto', value: 'auto' }, - { label: 'Year', value: '%Y' }, - { label: 'Month', value: '%m' }, - { label: 'Day', value: '%d' }, - { label: 'Day Of Week', value: '%w' }, { label: '%Y/%m/%d', value: '%Y/%m/%d' }, { label: '%Y-%m-%d', value: '%Y-%m-%d' }, + { label: '%y/%m/%d', value: '%y/%m/%d' }, + { label: '%y-%m-%d', value: '%y-%m-%d' }, { label: '%d/%m/%Y', value: '%d/%m/%Y' }, { label: '%d-%m-%Y', value: '%d-%m-%Y' }, - { label: 'Typing', value: 'typing' }, + { label: '%d/%m/%y', value: '%d/%m/%y' }, + { label: '%d-%m-%y', value: '%d-%m-%y' }, + { label: 'Typing', value: 'typing' } ]; let formatOptionTag = new com_String(); formatList.forEach(opt => { @@ -2224,15 +2225,14 @@ define([
-
- +
+ +
-