re-introduce selectively collapsible settings groups
This commit is contained in:
parent
d7b77dd61d
commit
30bac4eef4
5 changed files with 74 additions and 24 deletions
|
|
@ -931,6 +931,14 @@ const conf = exports({
|
|||
ortho: false,
|
||||
devel: false
|
||||
},
|
||||
// hidden ui groups
|
||||
hidden: {
|
||||
"fdm-base": true,
|
||||
"fdm-cool": true,
|
||||
"fdm-fill": true,
|
||||
"fdm-supp": true,
|
||||
"fdm-xprt": true
|
||||
},
|
||||
// label state preferences
|
||||
labels: {
|
||||
'CAM-3-arrows': false,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
proto = location.protocol,
|
||||
ver = Date.now().toString(36),
|
||||
separator = true,
|
||||
hideable = true,
|
||||
inline = true,
|
||||
driven = true;
|
||||
|
||||
let currentDevice = null,
|
||||
|
|
@ -1685,33 +1687,33 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
/** Device Browser / Editor */
|
||||
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true }),
|
||||
device: newGroup(LANG.dv_gr_dev, null, {group:"ddev", inline:true, class:"noshow"}),
|
||||
device: newGroup(LANG.dv_gr_dev, null, {group:"ddev", inline, class:"noshow"}),
|
||||
|
||||
_____: newGroup("workspace", null, {group:"dext", inline:true}),
|
||||
_____: newGroup("workspace", null, {group:"dext", inline}),
|
||||
bedWidth: newInput('X (width)', {title:LANG.dv_bedw_l, convert:toFloat, size:6, units:true, round:2, action:updateDeviceSize}),
|
||||
bedDepth: newInput('Y (depth)', {title:LANG.dv_bedw_l, convert:toFloat, size:6, units:true, round:2, action:updateDeviceSize}),
|
||||
maxHeight: newInput('Z (height)', {title:LANG.dv_bedw_l, convert:toFloat, size:6, units:true, round:2, action:updateDeviceSize}),
|
||||
resolutionX: newInput(LANG.dv_rezx_s, {title:LANG.dv_rezx_l, convert:toInt, size:6, modes:SLA}),
|
||||
resolutionY: newInput(LANG.dv_rezy_s, {title:LANG.dv_rezy_l, convert:toInt, size:6, modes:SLA}),
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:NO_WEDM }),
|
||||
_____: newGroup("firmware", null, {group:"dext", inline:true, modes:NO_WEDM}),
|
||||
_____: newGroup("firmware", null, {group:"dext", inline, modes:NO_WEDM}),
|
||||
fwRetract: newBoolean(LANG.dv_retr_s, onBooleanClick, {title:LANG.dv_retr_l, modes:FDM}),
|
||||
deviceOrigin: newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l, modes:FDM_LZN, show:() => !ui.deviceRound.checked}),
|
||||
deviceRound: newBoolean(LANG.dv_bedc_s, onBooleanClick, {title:LANG.dv_bedc_l, modes:FDM, trigger:true, show:isNotBelt}),
|
||||
deviceBelt: newBoolean(LANG.dv_belt_s, onBooleanClick, {title:LANG.dv_belt_l, modes:FDM, trigger:true, show:() => !ui.deviceRound.checked}),
|
||||
separator: newBlank({class:"pop-sep", modes:FDM, driven:true}),
|
||||
separator: newBlank({class:"pop-sep", modes:FDM, driven}),
|
||||
spindleMax: newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:toInt, size:5, modes:CAM, trigger:1}),
|
||||
deviceZMax: newInput(LANG.dv_zmax_s, {title:LANG.dv_zmax_l, convert:toInt, size:5, modes:FDM}),
|
||||
gcodeTime: newInput(LANG.dv_time_s, {title:LANG.dv_time_l, convert:toFloat, size:5, modes:FDM}),
|
||||
filamentSource: newSelect(LANG.dv_fsrc_s, {title: LANG.dv_fsrc_l, action: filamentSourceSave, modes:FDM, show:() => false}, "filasrc"),
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:FDM }),
|
||||
extruder: newGroup(LANG.dv_gr_ext, null, {group:"dext", inline:true}),
|
||||
extruder: newGroup(LANG.dv_gr_ext, null, {group:"dext", inline}),
|
||||
extFilament: newInput(LANG.dv_fila_s, {title:LANG.dv_fila_l, convert:toFloat, modes:FDM}),
|
||||
extNozzle: newInput(LANG.dv_nozl_s, {title:LANG.dv_nozl_l, convert:toFloat, modes:FDM}),
|
||||
extOffsetX: newInput(LANG.dv_exox_s, {title:LANG.dv_exox_l, convert:toFloat, modes:FDM}),
|
||||
extOffsetY: newInput(LANG.dv_exoy_s, {title:LANG.dv_exoy_l, convert:toFloat, modes:FDM}),
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:FDM_CAM }),
|
||||
_____: newGroup(LANG.dv_gr_too, null, {group:"dext", inline:true}),
|
||||
_____: newGroup(LANG.dv_gr_too, null, {group:"dext", inline}),
|
||||
extSelect: newText(LANG.dv_exts_s, {title:LANG.dv_exts_l, size:14, height:3, area:gcode}),
|
||||
extDeselect: newText(LANG.dv_dext_s, {title:LANG.dv_dext_l, size:14, height:3, area:gcode}),
|
||||
extPad: newBlank({class:"grow", modes:FDM}),
|
||||
|
|
@ -1722,7 +1724,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
ui.extNext = newButton(undefined, undefined, {icon:'<i class="fas fa-greater-than"></i>'})
|
||||
], {class:"dev-buttons ext-buttons", modes:FDM}),
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:FDM, show: () => false && ui.filamentSource.selectedOptions[0].value === 'palette3' }),
|
||||
palette: newGroup(LANG.dv_gr_pal, null, {group:"dext2", inline:true, modes:FDM}),
|
||||
palette: newGroup(LANG.dv_gr_pal, null, {group:"dext2", inline, modes:FDM}),
|
||||
paletteId: newInput(LANG.dv_paid_s, {title:LANG.dv_paid_l, modes:FDM, size:15, text:true}),
|
||||
palettePing: newInput(LANG.dv_paps_s, {title:LANG.dv_paps_l, modes:FDM, convert:toInt}),
|
||||
paletteFeed: newInput(LANG.dv_pafe_s, {title:LANG.dv_pafe_l, modes:FDM, convert:toInt}),
|
||||
|
|
@ -1733,12 +1735,12 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
paletteCool: newInput(LANG.dv_paco_s, {title:LANG.dv_paco_l, modes:FDM, convert:toInt}),
|
||||
palettePress: newInput(LANG.dv_pacm_s, {title:LANG.dv_pacm_l, modes:FDM, convert:toInt}),
|
||||
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:CAM_LZR }),
|
||||
_____: newGroup(LANG.dv_gr_out, null, {group:"dgco", inline:true}),
|
||||
_____: newGroup(LANG.dv_gr_out, null, {group:"dgco", inline}),
|
||||
gcodeStrip: newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}),
|
||||
gcodeSpace: newBoolean(LANG.dv_tksp_s, onBooleanClick, {title:LANG.dv_tksp_l, modes:CAM_LZR}),
|
||||
useLaser: newBoolean(LANG.dv_lazr_s, onBooleanClick, {title:LANG.dv_lazr_l, modes:CAM}),
|
||||
gcodeFExt: newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LZR, size:7, text:true}),
|
||||
gcodeEd: newGroup(LANG.dv_gr_gco, $('dg'), {group:"dgcp", inline:true, modes:GCODE}),
|
||||
gcodeEd: newGroup(LANG.dv_gr_gco, $('dg'), {group:"dgcp", inline, modes:GCODE}),
|
||||
gcodeMacros: newRow([
|
||||
(ui.gcodePre = newGCode(LANG.dv_head_s, {title:LANG.dv_head_l, modes:GCODE, area:gcode})).button,
|
||||
(ui.gcodePost = newGCode(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:GCODE, area:gcode})).button,
|
||||
|
|
@ -1798,21 +1800,21 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
/** FDM Settings */
|
||||
|
||||
_____: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven, hideable, separator, group:"fdm-layers" }),
|
||||
sliceHeight: newInput(LANG.sl_lahi_s, { title:LANG.sl_lahi_l, convert:toFloat }),
|
||||
sliceMinHeight: newInput(LANG.ad_minl_s, { title:LANG.ad_minl_l, convert:toFloat, bound:bound(0,3.0), show:() => ui.sliceAdaptive.checked }),
|
||||
sliceTopLayers: newInput(LANG.sl_ltop_s, { title:LANG.sl_ltop_l, convert:toInt }),
|
||||
sliceBottomLayers: newInput(LANG.sl_lbot_s, { title:LANG.sl_lbot_l, convert:toInt }),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
sliceAdaptive: newBoolean(LANG.ad_adap_s, onBooleanClick, { title: LANG.ad_adap_l }),
|
||||
_____: newGroup(LANG.sw_menu, $('fdm-walls'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.sw_menu, $('fdm-walls'), { modes:FDM, driven, hideable, separator, group:"fdm-walls" }),
|
||||
sliceShells: newInput(LANG.sl_shel_s, { title:LANG.sl_shel_l, convert:toFloat }),
|
||||
sliceLineWidth: newInput(LANG.sl_line_s, { title:LANG.sl_line_l, convert:toFloat, bound:bound(0,5) }),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
sliceShellOrder: newSelect(LANG.sl_ordr_s, { title:LANG.sl_ordr_l}, "shell"),
|
||||
sliceDetectThin: newSelect(LANG.ad_thin_s, { title: LANG.ad_thin_l, action: thinWallSave }, "thin"),
|
||||
outputAlternating: newBoolean(LANG.ad_altr_s, onBooleanClick, {title:LANG.ad_altr_l}),
|
||||
_____: newGroup(LANG.fi_menu, $('fdm-fill'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.fi_menu, $('fdm-fill'), { modes:FDM, driven, hideable, separator, group:"fdm-fill" }),
|
||||
sliceFillType: newSelect(LANG.fi_type, {trigger:true}, "infill"),
|
||||
sliceFillSparse: newInput(LANG.fi_pcnt_s, {title:LANG.fi_pcnt_l, convert:toFloat, bound:bound(0.0,1.0)}),
|
||||
sliceFillRepeat: newInput(LANG.fi_rept_s, {title:LANG.fi_rept_l, convert:toInt, bound:bound(1,10), show: fillShow}),
|
||||
|
|
@ -1823,13 +1825,13 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
separator: newBlank({ class:"set-sep", driven }),
|
||||
sliceFillGrow: newInput(LANG.fi_grow_s, {title:LANG.fi_grow_l, convert:toFloat}),
|
||||
sliceFillAngle: newInput(LANG.fi_angl_s, {title:LANG.fi_angl_l, convert:toFloat}),
|
||||
_____: newGroup(LANG.fh_menu, $('fdm-heat'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.fh_menu, $('fdm-heat'), { modes:FDM, driven, hideable, separator, group:"fdm-heat" }),
|
||||
outputTemp: newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:toInt}),
|
||||
outputBedTemp: newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:toInt}),
|
||||
_____: newGroup(LANG.fc_menu, $('fdm-cool'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.fc_menu, $('fdm-cool'), { modes:FDM, driven, hideable, separator, group:"fdm-cool" }),
|
||||
outputFanLayer: newInput(LANG.ou_fanl_s, { title:LANG.ou_fanl_l, convert:toInt, bound:bound(0,255) }),
|
||||
outputFanSpeed: newInput(LANG.ou_fans_s, {title:LANG.ou_fans_l, convert:toInt, bound:bound(0,255)}),
|
||||
_____: newGroup(LANG.sp_menu, $('fdm-support'), { modes:FDM, marker:false, driven, separator }),
|
||||
_____: newGroup(LANG.sp_menu, $('fdm-support'), { modes:FDM, driven, hideable, separator, group:"fdm-supp" }),
|
||||
sliceSupportNozzle: newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, show:isMultiHead}, "extruders"),
|
||||
sliceSupportDensity: newInput(LANG.sp_dens_s, {title:LANG.sp_dens_l, convert:toFloat, bound:bound(0.0,1.0)}),
|
||||
sliceSupportSize: newInput(LANG.sp_size_s, {title:LANG.sp_size_l, convert:toFloat, bound:bound(1.0,200.0)}),
|
||||
|
|
@ -1853,7 +1855,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
(ui.ssmDun = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-check"></i>'})),
|
||||
(ui.ssmClr = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-trash-alt"></i>'}))
|
||||
], {class:"ext-buttons f-row"}),
|
||||
_____: newGroup(LANG.fl_menu, $('fdm-base'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.fl_menu, $('fdm-base'), { modes:FDM, driven, hideable, separator, group:"fdm-base" }),
|
||||
firstSliceHeight: newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:toFloat, show:isNotBelt}),
|
||||
firstLayerNozzleTemp:newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:toInt, show:isNotBelt}),
|
||||
firstLayerBedTemp: newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:toInt, show:isNotBelt}),
|
||||
|
|
@ -1881,7 +1883,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
separator: newBlank({ class:"set-sep", driven, show:isNotBelt }),
|
||||
outputRaft: newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, trigger: true, show:() => isNotBelt()}),
|
||||
outputDraftShield: newBoolean(LANG.fr_draf_s, onBooleanClick, {title:LANG.fr_draf_l, trigger: true, show:() => isNotBelt()}),
|
||||
_____: newGroup(LANG.ou_menu, $('fdm-output'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.ou_menu, $('fdm-output'), { modes:FDM, driven, hideable, separator, group:"fdm-out" }),
|
||||
outputFeedrate: newInput(LANG.ou_feed_s, {title:LANG.ou_feed_l, convert:toInt}),
|
||||
outputFinishrate: newInput(LANG.ou_fini_s, {title:LANG.ou_fini_l, convert:toInt}),
|
||||
outputSeekrate: newInput(LANG.ou_move_s, {title:LANG.ou_move_l, convert:toInt}),
|
||||
|
|
@ -1900,7 +1902,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
separator: newBlank({ class:"set-sep", driven, show:isMultiHead }),
|
||||
outputBeltFirst: newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show: isBelt}),
|
||||
outputNozzle: newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, show:isMultiHead}, "extruders"),
|
||||
_____: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven, separator }),
|
||||
_____: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven, hideable, separator, group:"fdm-xprt" }),
|
||||
sliceAngle: newInput(LANG.sl_angl_s, {title:LANG.sl_angl_l, convert:toFloat, show:isBelt}),
|
||||
outputRetractDwell: newInput(LANG.ad_rdwl_s, {title:LANG.ad_rdwl_l, convert:toInt}),
|
||||
sliceSolidMinArea: newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:toFloat}),
|
||||
|
|
@ -1946,7 +1948,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
camZClearance: newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:toFloat, bound:bound(0.01,100), units:true}),
|
||||
camFastFeedZ: newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:toFloat, units:true}),
|
||||
camFastFeed: newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:toFloat, units:true}),
|
||||
_____: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven, separator }),
|
||||
_____: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven, separator, group:"cam-output" }),
|
||||
camConventional: newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l}),
|
||||
camEaseDown: newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l}),
|
||||
camDepthFirst: newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l}),
|
||||
|
|
@ -1963,7 +1965,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
camOriginOffX: newInput(LANG.co_offx_s, {title:LANG.co_offx_l, convert:toFloat, units:true}),
|
||||
camOriginOffY: newInput(LANG.co_offy_s, {title:LANG.co_offy_l, convert:toFloat, units:true}),
|
||||
camOriginOffZ: newInput(LANG.co_offz_s, {title:LANG.co_offz_l, convert:toFloat, units:true}),
|
||||
_____: newGroup(LANG.op_xprt_s, $('cam-expert'), { group: "cam_expert", modes:CAM, marker: false, driven, separator }),
|
||||
_____: newGroup(LANG.op_xprt_s, $('cam-expert'), { group:"cam_expert", modes:CAM, marker: false, driven, separator }),
|
||||
camExpertFast: newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, show: () => !ui.camTrueShadow.checked }),
|
||||
camTrueShadow: newBoolean(LANG.cx_true_s, onBooleanClick, {title:LANG.cx_true_l, show: () => !ui.camExpertFast.checked }),
|
||||
|
||||
|
|
@ -1990,7 +1992,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
ctOutTileSpacing: newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:toInt}),
|
||||
ctOutMerged: newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:TWONED}),
|
||||
ctOutGroup: newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, show:() => !ui.ctOutStack.checked}),
|
||||
_____: newGroup(LANG.ou_menu, $('lzr-output'), { modes:TWOD, driven, separator }),
|
||||
_____: newGroup(LANG.ou_menu, $('lzr-output'), { modes:TWOD, driven, separator, group:"lzr-output" }),
|
||||
ctOutPower: newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:toInt, bound:bound(1,100), modes:TWONED}),
|
||||
ctOutSpeed: newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:toInt}),
|
||||
ctAdaptive: newBoolean('adaptive speed', onBooleanClick, {modes:WEDM, title:'controller determines best cutting speed based on material feedback at runtime'}),
|
||||
|
|
@ -2034,7 +2036,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
slaSupportSize: newInput(LANG.sa_slsz_s, {title:LANG.sa_slsz_l, convert:toFloat, bound:bound(0.1,1)}),
|
||||
slaSupportPoints: newInput(LANG.sa_slpt_s, {title:LANG.sa_slpt_l, convert:toInt, bound:bound(3,10)}),
|
||||
slaSupportEnable: newBoolean(LANG.enable, onBooleanClick, {title:LANG.sl_slen_l}),
|
||||
slaOutput: newGroup(LANG.sa_outp_m, $('sla-output'), { modes:SLA, group:"sla-first", driven, separator }),
|
||||
slaOutput: newGroup(LANG.sa_outp_m, $('sla-output'), { modes:SLA, driven, separator, group:"sla-output" }),
|
||||
slaFirstOffset: newInput(LANG.sa_opzo_s, {title:LANG.sa_opzo_l, convert:toFloat, bound:bound(0,1)}),
|
||||
slaAntiAlias: newSelect(LANG.sa_opaa_s, {title:LANG.sa_opaa_l}, "antialias"),
|
||||
|
||||
|
|
@ -2573,7 +2575,6 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
ui.sync = function() {
|
||||
const current = settings();
|
||||
const control = current.controller;
|
||||
const process = settings.process;
|
||||
|
||||
platform.deselect();
|
||||
catalog.addFileListener(updateCatalog);
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@ function loadSettings(evt, named) {
|
|||
|
||||
// publish event when loading from ui event
|
||||
if (evt) api.event.settings();
|
||||
|
||||
// update hidden map from settings
|
||||
api.uc.setHidden(settings.hidden);
|
||||
}
|
||||
|
||||
function showSettings() {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
groups = {},
|
||||
groupSticky = false,
|
||||
groupName = undefined,
|
||||
heads = {}, // hideable group heads (clickable label)
|
||||
hidden = {}, // hidden groups (by name)
|
||||
hasModes = [],
|
||||
setters = [],
|
||||
lastMode = null,
|
||||
|
|
@ -37,6 +39,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
checkpoint,
|
||||
restore,
|
||||
refresh,
|
||||
setHidden,
|
||||
setMode,
|
||||
bound,
|
||||
toInt,
|
||||
|
|
@ -77,6 +80,14 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
}
|
||||
};
|
||||
|
||||
function setHidden(map) {
|
||||
hidden = map;
|
||||
refresh();
|
||||
for (let ctrl of Object.values(heads)) {
|
||||
ctrl.update();
|
||||
}
|
||||
}
|
||||
|
||||
function onBlur(obj, fn) {
|
||||
if (Array.isArray(obj)) {
|
||||
for (let o of obj) onBlur(o, fn);
|
||||
|
|
@ -246,6 +257,29 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
lastGroup.key = dbkey;
|
||||
groupName = group;
|
||||
|
||||
if (opt.hideable) {
|
||||
let pad = DOC.createElement('i');
|
||||
let arr = DOC.createElement('span');
|
||||
pad.setAttribute('class','grow');
|
||||
row.appendChild(pad);
|
||||
row.appendChild(arr);
|
||||
const ctrl = heads[group] = {
|
||||
row,
|
||||
arr,
|
||||
update() {
|
||||
arr.innerHTML = (hidden[group] ?
|
||||
'<i class="fa-solid fa-caret-down"></i>' :
|
||||
'<i class="fa-solid fa-caret-up"></i>'
|
||||
);
|
||||
}
|
||||
};
|
||||
row.onclick = () => {
|
||||
hidden[group] = !hidden[group];
|
||||
refresh();
|
||||
ctrl.update();
|
||||
};
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
|
|
@ -337,13 +371,14 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
else el.hideMe();
|
||||
};
|
||||
el.setMode = function(mode) {
|
||||
let hidn = hidden[el._group] === true;
|
||||
let xprt = opt.expert === undefined || (opt.expert === lastExpert);
|
||||
let show = opt.show ? safecall(opt.show) : true;
|
||||
let disp = opt.visible ? opt.visible() : true;
|
||||
let hmod = el.hasMode(mode);
|
||||
if (opt.trace) console.log({ setMode: mode, xprt, show, disp, hmod, modes:el.modes });
|
||||
if (opt.manual) return;
|
||||
el.setVisible(hmod && show && xprt && disp);
|
||||
el.setVisible(!hidn && hmod && show && xprt && disp);
|
||||
}
|
||||
el.hasMode = function(mode) {
|
||||
return (el.modes.length === 0) ||
|
||||
|
|
|
|||
|
|
@ -2174,6 +2174,9 @@ th, tr, td, label {
|
|||
padding: 4px;
|
||||
margin: 0 0 4px 0;
|
||||
}
|
||||
.set-header > span {
|
||||
color: var(--blue-2);
|
||||
}
|
||||
.set-header-line {
|
||||
margin-left: 5px;
|
||||
width: 100%;
|
||||
|
|
|
|||
Loading…
Reference in a new issue