@odoo/o-spreadsheet 15.0.7 → 15.0.9
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.
|
@@ -15289,20 +15289,20 @@ const TEMPLATE$l = xml$n /* xml */ `
|
|
|
15289
15289
|
<div class="o-section-title" t-esc="env._t('${conditionalFormattingTerms.CF_TITLE}')"></div>
|
|
15290
15290
|
<div class="o_field_radio o_horizontal o_field_widget o-cf-type-selector">
|
|
15291
15291
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('CellIsRule')">
|
|
15292
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15292
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'CellIsRule'" type="radio" id="cellIsRule" name="ruleType" value="CellIsRule"/>
|
|
15293
15293
|
<label for="cellIsRule" class="custom-control-label o_form_label">
|
|
15294
15294
|
<t t-esc="env._t('${conditionalFormattingTerms.SingleColor}')"/>
|
|
15295
15295
|
</label>
|
|
15296
15296
|
</div>
|
|
15297
15297
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('ColorScaleRule')">
|
|
15298
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15298
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'ColorScaleRule'" type="radio" id="colorScaleRule" name="ruleType" value="ColorScaleRule"/>
|
|
15299
15299
|
<label for="colorScaleRule" class="custom-control-label o_form_label">
|
|
15300
15300
|
<t t-esc="env._t('${conditionalFormattingTerms.ColorScale}')"/>
|
|
15301
15301
|
</label>
|
|
15302
15302
|
</div>
|
|
15303
15303
|
|
|
15304
15304
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('IconSetRule')">
|
|
15305
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15305
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'IconSetRule'" type="radio" id="iconSetRule" name="ruleType" value="IconSetRule"/>
|
|
15306
15306
|
<label for="iconSetRule" class="custom-control-label o_form_label">
|
|
15307
15307
|
<t t-esc="env._t('${conditionalFormattingTerms.IconSet}')"/>
|
|
15308
15308
|
</label>
|
|
@@ -27490,6 +27490,7 @@ class Composer extends owl.Component {
|
|
|
27490
27490
|
autoCompleteComp.moveDown();
|
|
27491
27491
|
}
|
|
27492
27492
|
}
|
|
27493
|
+
this.updateCursorIfNeeded();
|
|
27493
27494
|
}
|
|
27494
27495
|
processTabKey(ev) {
|
|
27495
27496
|
ev.preventDefault();
|
|
@@ -27545,9 +27546,12 @@ class Composer extends owl.Component {
|
|
|
27545
27546
|
}
|
|
27546
27547
|
else {
|
|
27547
27548
|
ev.stopPropagation();
|
|
27549
|
+
this.updateCursorIfNeeded();
|
|
27548
27550
|
}
|
|
27549
|
-
|
|
27551
|
+
}
|
|
27552
|
+
updateCursorIfNeeded() {
|
|
27550
27553
|
if (!this.getters.isSelectingForComposer()) {
|
|
27554
|
+
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
27551
27555
|
this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
27552
27556
|
this.isKeyStillDown = true;
|
|
27553
27557
|
}
|
|
@@ -31403,6 +31407,6 @@ exports.registries = registries;
|
|
|
31403
31407
|
exports.setTranslationMethod = setTranslationMethod;
|
|
31404
31408
|
|
|
31405
31409
|
|
|
31406
|
-
__info__.version = '15.0.
|
|
31407
|
-
__info__.date = '2023-
|
|
31408
|
-
__info__.hash = '
|
|
31410
|
+
__info__.version = '15.0.9';
|
|
31411
|
+
__info__.date = '2023-06-12T13:46:56.382Z';
|
|
31412
|
+
__info__.hash = '40ae7eb';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4805,6 +4805,7 @@ declare class Composer extends Component<Props$8, SpreadsheetEnv> {
|
|
|
4805
4805
|
onCompositionStart(): void;
|
|
4806
4806
|
onCompositionEnd(): void;
|
|
4807
4807
|
onKeydown(ev: KeyboardEvent): void;
|
|
4808
|
+
private updateCursorIfNeeded;
|
|
4808
4809
|
onInput(): void;
|
|
4809
4810
|
onKeyup(ev: KeyboardEvent): void;
|
|
4810
4811
|
onMousedown(ev: MouseEvent): void;
|
|
@@ -15266,20 +15266,20 @@ const TEMPLATE$l = xml$n /* xml */ `
|
|
|
15266
15266
|
<div class="o-section-title" t-esc="env._t('${conditionalFormattingTerms.CF_TITLE}')"></div>
|
|
15267
15267
|
<div class="o_field_radio o_horizontal o_field_widget o-cf-type-selector">
|
|
15268
15268
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('CellIsRule')">
|
|
15269
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15269
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'CellIsRule'" type="radio" id="cellIsRule" name="ruleType" value="CellIsRule"/>
|
|
15270
15270
|
<label for="cellIsRule" class="custom-control-label o_form_label">
|
|
15271
15271
|
<t t-esc="env._t('${conditionalFormattingTerms.SingleColor}')"/>
|
|
15272
15272
|
</label>
|
|
15273
15273
|
</div>
|
|
15274
15274
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('ColorScaleRule')">
|
|
15275
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15275
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'ColorScaleRule'" type="radio" id="colorScaleRule" name="ruleType" value="ColorScaleRule"/>
|
|
15276
15276
|
<label for="colorScaleRule" class="custom-control-label o_form_label">
|
|
15277
15277
|
<t t-esc="env._t('${conditionalFormattingTerms.ColorScale}')"/>
|
|
15278
15278
|
</label>
|
|
15279
15279
|
</div>
|
|
15280
15280
|
|
|
15281
15281
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('IconSetRule')">
|
|
15282
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15282
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'IconSetRule'" type="radio" id="iconSetRule" name="ruleType" value="IconSetRule"/>
|
|
15283
15283
|
<label for="iconSetRule" class="custom-control-label o_form_label">
|
|
15284
15284
|
<t t-esc="env._t('${conditionalFormattingTerms.IconSet}')"/>
|
|
15285
15285
|
</label>
|
|
@@ -27467,6 +27467,7 @@ class Composer extends Component {
|
|
|
27467
27467
|
autoCompleteComp.moveDown();
|
|
27468
27468
|
}
|
|
27469
27469
|
}
|
|
27470
|
+
this.updateCursorIfNeeded();
|
|
27470
27471
|
}
|
|
27471
27472
|
processTabKey(ev) {
|
|
27472
27473
|
ev.preventDefault();
|
|
@@ -27522,9 +27523,12 @@ class Composer extends Component {
|
|
|
27522
27523
|
}
|
|
27523
27524
|
else {
|
|
27524
27525
|
ev.stopPropagation();
|
|
27526
|
+
this.updateCursorIfNeeded();
|
|
27525
27527
|
}
|
|
27526
|
-
|
|
27528
|
+
}
|
|
27529
|
+
updateCursorIfNeeded() {
|
|
27527
27530
|
if (!this.getters.isSelectingForComposer()) {
|
|
27531
|
+
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
27528
27532
|
this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
27529
27533
|
this.isKeyStillDown = true;
|
|
27530
27534
|
}
|
|
@@ -31358,6 +31362,6 @@ const helpers = {
|
|
|
31358
31362
|
export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
|
|
31359
31363
|
|
|
31360
31364
|
|
|
31361
|
-
__info__.version = '15.0.
|
|
31362
|
-
__info__.date = '2023-
|
|
31363
|
-
__info__.hash = '
|
|
31365
|
+
__info__.version = '15.0.9';
|
|
31366
|
+
__info__.date = '2023-06-12T13:46:56.382Z';
|
|
31367
|
+
__info__.hash = '40ae7eb';
|
|
@@ -15286,20 +15286,20 @@
|
|
|
15286
15286
|
<div class="o-section-title" t-esc="env._t('${conditionalFormattingTerms.CF_TITLE}')"></div>
|
|
15287
15287
|
<div class="o_field_radio o_horizontal o_field_widget o-cf-type-selector">
|
|
15288
15288
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('CellIsRule')">
|
|
15289
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15289
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'CellIsRule'" type="radio" id="cellIsRule" name="ruleType" value="CellIsRule"/>
|
|
15290
15290
|
<label for="cellIsRule" class="custom-control-label o_form_label">
|
|
15291
15291
|
<t t-esc="env._t('${conditionalFormattingTerms.SingleColor}')"/>
|
|
15292
15292
|
</label>
|
|
15293
15293
|
</div>
|
|
15294
15294
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('ColorScaleRule')">
|
|
15295
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15295
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'ColorScaleRule'" type="radio" id="colorScaleRule" name="ruleType" value="ColorScaleRule"/>
|
|
15296
15296
|
<label for="colorScaleRule" class="custom-control-label o_form_label">
|
|
15297
15297
|
<t t-esc="env._t('${conditionalFormattingTerms.ColorScale}')"/>
|
|
15298
15298
|
</label>
|
|
15299
15299
|
</div>
|
|
15300
15300
|
|
|
15301
15301
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('IconSetRule')">
|
|
15302
|
-
<input class="custom-control-input o_radio_input" t-
|
|
15302
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'IconSetRule'" type="radio" id="iconSetRule" name="ruleType" value="IconSetRule"/>
|
|
15303
15303
|
<label for="iconSetRule" class="custom-control-label o_form_label">
|
|
15304
15304
|
<t t-esc="env._t('${conditionalFormattingTerms.IconSet}')"/>
|
|
15305
15305
|
</label>
|
|
@@ -27487,6 +27487,7 @@
|
|
|
27487
27487
|
autoCompleteComp.moveDown();
|
|
27488
27488
|
}
|
|
27489
27489
|
}
|
|
27490
|
+
this.updateCursorIfNeeded();
|
|
27490
27491
|
}
|
|
27491
27492
|
processTabKey(ev) {
|
|
27492
27493
|
ev.preventDefault();
|
|
@@ -27542,9 +27543,12 @@
|
|
|
27542
27543
|
}
|
|
27543
27544
|
else {
|
|
27544
27545
|
ev.stopPropagation();
|
|
27546
|
+
this.updateCursorIfNeeded();
|
|
27545
27547
|
}
|
|
27546
|
-
|
|
27548
|
+
}
|
|
27549
|
+
updateCursorIfNeeded() {
|
|
27547
27550
|
if (!this.getters.isSelectingForComposer()) {
|
|
27551
|
+
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
27548
27552
|
this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
27549
27553
|
this.isKeyStillDown = true;
|
|
27550
27554
|
}
|
|
@@ -31402,9 +31406,9 @@
|
|
|
31402
31406
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
31403
31407
|
|
|
31404
31408
|
|
|
31405
|
-
__info__.version = '15.0.
|
|
31406
|
-
__info__.date = '2023-
|
|
31407
|
-
__info__.hash = '
|
|
31409
|
+
__info__.version = '15.0.9';
|
|
31410
|
+
__info__.date = '2023-06-12T13:46:56.382Z';
|
|
31411
|
+
__info__.hash = '40ae7eb';
|
|
31408
31412
|
|
|
31409
31413
|
|
|
31410
31414
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -712,20 +712,20 @@
|
|
|
712
712
|
<div class="o-section-title" t-esc="env._t('${ql.CF_TITLE}')"></div>
|
|
713
713
|
<div class="o_field_radio o_horizontal o_field_widget o-cf-type-selector">
|
|
714
714
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('CellIsRule')">
|
|
715
|
-
<input class="custom-control-input o_radio_input" t-
|
|
715
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'CellIsRule'" type="radio" id="cellIsRule" name="ruleType" value="CellIsRule"/>
|
|
716
716
|
<label for="cellIsRule" class="custom-control-label o_form_label">
|
|
717
717
|
<t t-esc="env._t('${ql.SingleColor}')"/>
|
|
718
718
|
</label>
|
|
719
719
|
</div>
|
|
720
720
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('ColorScaleRule')">
|
|
721
|
-
<input class="custom-control-input o_radio_input" t-
|
|
721
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'ColorScaleRule'" type="radio" id="colorScaleRule" name="ruleType" value="ColorScaleRule"/>
|
|
722
722
|
<label for="colorScaleRule" class="custom-control-label o_form_label">
|
|
723
723
|
<t t-esc="env._t('${ql.ColorScale}')"/>
|
|
724
724
|
</label>
|
|
725
725
|
</div>
|
|
726
726
|
|
|
727
727
|
<div class="custom-control custom-radio o_cf_radio_item" t-on-click="changeRuleType('IconSetRule')">
|
|
728
|
-
<input class="custom-control-input o_radio_input" t-
|
|
728
|
+
<input class="custom-control-input o_radio_input" t-att-checked="state.currentCFType === 'IconSetRule'" type="radio" id="iconSetRule" name="ruleType" value="IconSetRule"/>
|
|
729
729
|
<label for="iconSetRule" class="custom-control-label o_form_label">
|
|
730
730
|
<t t-esc="env._t('${ql.IconSet}')"/>
|
|
731
731
|
</label>
|
|
@@ -1912,7 +1912,7 @@
|
|
|
1912
1912
|
.o-topbar-toolbar .o-composer-container:focus-within {
|
|
1913
1913
|
border: 1px solid ${p};
|
|
1914
1914
|
}
|
|
1915
|
-
`;class Bp extends t.Component{constructor(){super(...arguments),this.composerRef=Mp("o_composer"),this.autoCompleteRef=Mp("o_autocomplete_provider"),this.getters=this.env.getters,this.dispatch=this.env.dispatch,this.composerState=Lp({positionStart:0,positionEnd:0}),this.autoCompleteState=Lp({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=Lp({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0}),this.isKeyStillDown=!1,this.compositionActive=!1,this.borderStyle="box-shadow: 0 1px 4px 3px rgba(60, 64, 67, 0.15);",this.shouldProcessInputEvents=!1,this.tokens=[],this.keyMapping={ArrowUp:this.processArrowKeys,ArrowDown:this.processArrowKeys,ArrowLeft:this.processArrowKeys,ArrowRight:this.processArrowKeys,Enter:this.processEnterKey,Escape:this.processEscapeKey,F2:()=>console.warn("Not implemented"),F4:()=>console.warn("Not implemented"),Tab:e=>this.processTabKey(e)},this.contentHelper=new vp(this.composerRef.el)}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const[e,t,,s]=this.props.rect;let i="";return t>this.props.delimitation.height-(t+s)&&(i+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(i+="right:0px;"),i+="width:300px;"}return"width:300px;"}mounted(){Ms.composer=this;const e=this.composerRef.el;this.contentHelper.updateEl(e),this.processContent()}willUnmount(){delete Ms.composer,this.trigger("composer-unmounted")}patched(){this.isKeyStillDown||this.processContent()}processArrowKeys(e){if(this.getters.isSelectingForComposer())return void(this.functionDescriptionState.showDescription=!1);if("cellFocus"===this.props.focus&&!this.autoCompleteState.showProvider)return;e.stopPropagation();const t=this.autoCompleteRef.comp;["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&t&&(e.preventDefault(),"ArrowUp"===e.key?t.moveUp():t.moveDown())}processTabKey(e){e.preventDefault(),e.stopPropagation();const t=this.autoCompleteRef.comp;if(this.autoCompleteState.showProvider&&t){const e=t.getValueToFill();if(e)return void this.autoComplete(e)}else this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const s=e.shiftKey?-1:1;this.dispatch("MOVE_POSITION",{deltaX:s,deltaY:0})}processEnterKey(e){e.preventDefault(),e.stopPropagation(),this.isKeyStillDown=!1;const t=this.autoCompleteRef.comp;if(this.autoCompleteState.showProvider&&t){const e=t.getValueToFill();if(e)return void this.autoComplete(e)}this.dispatch("STOP_EDITION"),this.dispatch("MOVE_POSITION",{deltaX:0,deltaY:e.shiftKey?-1:1})}processEscapeKey(){this.dispatch("STOP_EDITION",{cancel:!0})}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key];t?t.call(this,e):e.stopPropagation()
|
|
1915
|
+
`;class Bp extends t.Component{constructor(){super(...arguments),this.composerRef=Mp("o_composer"),this.autoCompleteRef=Mp("o_autocomplete_provider"),this.getters=this.env.getters,this.dispatch=this.env.dispatch,this.composerState=Lp({positionStart:0,positionEnd:0}),this.autoCompleteState=Lp({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=Lp({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0}),this.isKeyStillDown=!1,this.compositionActive=!1,this.borderStyle="box-shadow: 0 1px 4px 3px rgba(60, 64, 67, 0.15);",this.shouldProcessInputEvents=!1,this.tokens=[],this.keyMapping={ArrowUp:this.processArrowKeys,ArrowDown:this.processArrowKeys,ArrowLeft:this.processArrowKeys,ArrowRight:this.processArrowKeys,Enter:this.processEnterKey,Escape:this.processEscapeKey,F2:()=>console.warn("Not implemented"),F4:()=>console.warn("Not implemented"),Tab:e=>this.processTabKey(e)},this.contentHelper=new vp(this.composerRef.el)}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const[e,t,,s]=this.props.rect;let i="";return t>this.props.delimitation.height-(t+s)&&(i+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(i+="right:0px;"),i+="width:300px;"}return"width:300px;"}mounted(){Ms.composer=this;const e=this.composerRef.el;this.contentHelper.updateEl(e),this.processContent()}willUnmount(){delete Ms.composer,this.trigger("composer-unmounted")}patched(){this.isKeyStillDown||this.processContent()}processArrowKeys(e){if(this.getters.isSelectingForComposer())return void(this.functionDescriptionState.showDescription=!1);if("cellFocus"===this.props.focus&&!this.autoCompleteState.showProvider)return;e.stopPropagation();const t=this.autoCompleteRef.comp;["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&t&&(e.preventDefault(),"ArrowUp"===e.key?t.moveUp():t.moveDown()),this.updateCursorIfNeeded()}processTabKey(e){e.preventDefault(),e.stopPropagation();const t=this.autoCompleteRef.comp;if(this.autoCompleteState.showProvider&&t){const e=t.getValueToFill();if(e)return void this.autoComplete(e)}else this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const s=e.shiftKey?-1:1;this.dispatch("MOVE_POSITION",{deltaX:s,deltaY:0})}processEnterKey(e){e.preventDefault(),e.stopPropagation(),this.isKeyStillDown=!1;const t=this.autoCompleteRef.comp;if(this.autoCompleteState.showProvider&&t){const e=t.getValueToFill();if(e)return void this.autoComplete(e)}this.dispatch("STOP_EDITION"),this.dispatch("MOVE_POSITION",{deltaX:0,deltaY:e.shiftKey?-1:1})}processEscapeKey(){this.dispatch("STOP_EDITION",{cancel:!0})}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key];t?t.call(this,e):(e.stopPropagation(),this.updateCursorIfNeeded())}updateCursorIfNeeded(){if(!this.getters.isSelectingForComposer()){const{start:e,end:t}=this.contentHelper.getCurrentSelection();this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:e,end:t}),this.isKeyStillDown=!0}}onInput(){if("inactive"===this.props.focus||!this.shouldProcessInputEvents)return;this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const e=this.composerRef.el;this.dispatch("SET_CURRENT_CONTENT",{content:e.childNodes.length?e.textContent:"",selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Shift","Tab","Enter"].includes(e.key))return;if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.getters.isSelectingForComposer()&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider=!1,e.ctrlKey&&" "===e.key)return this.autoCompleteState.search="",this.autoCompleteState.showProvider=!0,void this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const{start:t,end:s}=this.getters.getComposerSelection(),{start:i,end:o}=this.contentHelper.getCurrentSelection();i===t&&o===s||this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}onClick(){if(this.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.dispatch("STOP_COMPOSER_RANGE_SELECTION"),"inactive"===this.props.focus&&this.trigger("composer-content-focused",{selection:e}),this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onBlur(){this.isKeyStillDown=!1}onCompleted(e){this.autoComplete(e.detail.text)}processContent(){if(this.compositionActive)return;this.contentHelper.removeAll(),this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&this.contentHelper.selectRange(0,0);const e=this.getContent();if(0!==e.length){this.contentHelper.setText(e);const{start:t,end:s}=this.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(t,s)}this.shouldProcessInputEvents=!0}getContent(){let e;const t=this.getters.getCurrentContent(),s=t.startsWith("=")&&this.getters.getCurrentTokens().length>0;return e=""===t?[]:s&&"inactive"!==this.getters.getEditionMode()?this.getColoredTokens():[{value:t}],e}getColoredTokens(){const e=this.getters.getCurrentTokens(),t=this.getters.getTokenAtCursor(),s=[],{end:i}=this.getters.getComposerSelection();for(const o of e){switch(o.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":s.push({value:o.value,color:Dp[o.type]||"#000"});break;case"SYMBOL":let e=o.value;const{xc:i,sheetName:n}=Jt(e);Qt.test(i)?s.push({value:o.value,color:this.rangeColor(i,n)||"#000"}):["TRUE","FALSE"].includes(e.toUpperCase())?s.push({value:o.value,color:Fp}):s.push({value:o.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===o.parenIndex?s.push({value:o.value,color:"pink"}):s.push({value:o.value,color:Dp[o.type]||"#000"});break;default:s.push({value:o.value,color:"#000"})}"waitingForRangeSelection"===this.getters.getEditionMode()&&i===o.end&&(s[s.length-1].class=$p)}return s}rangeColor(e,t){if("inactive"===this.getters.getEditionMode())return;const s=this.getters.getHighlights(),i=t?this.getters.getSheetIdByName(t):this.getters.getEditionSheet(),o=s.find((t=>{if(t.sheet!==i)return!1;let s=_s(e);const{height:o,width:n}=zs(s);return s=o*n==1?this.getters.expandZone(i,_s(e)):s,t.sheet===i&&Ds(s,t.zone)}));return o&&o.color?o.color:void 0}processTokenAtCursor(){let e=this.getters.getCurrentContent();if(this.autoCompleteState.showProvider=!1,this.functionDescriptionState.showDescription=!1,e.startsWith("=")){const e=this.getters.getTokenAtCursor();if(e){const{xc:t}=Jt(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!Qt.test(t))this.autoCompleteState.search=e.value,this.autoCompleteState.showProvider=!0;else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,s=t.parent.toUpperCase(),i=Op[s],o=t.argPosition;this.functionDescriptionState.functionName=s,this.functionDescriptionState.functionDescription=i,this.functionDescriptionState.argToFocus=i.getArgToFocus(o+1)-1,this.functionDescriptionState.showDescription=!0}}}}autoComplete(e){if(e){const t=this.getters.getTokenAtCursor();if(t){let s=t.end,i=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(s=t.start);const o=this.getters.getCurrentTokens();if(this.autoCompleteState.provider&&o.length){e+="(";const s=o.map((e=>e.start)).indexOf(t.start);if(s+1<o.length){"LEFT_PAREN"===o[s+1].type&&i++}}this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s,end:i})}this.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}Bp.template=Pp,Bp.style=Up,Bp.components={TextValueProvider:mp,FunctionDescriptionProvider:Rp},Bp.defaultProps={inputStyle:"",focus:"inactive"};const{useState:Vp}=t.hooks,{xml:Hp,css:zp}=t.tags,Zp=Hp`
|
|
1916
1916
|
<div class="o-grid-composer" t-att-style="containerStyle">
|
|
1917
1917
|
<Composer
|
|
1918
1918
|
focus = "props.focus"
|
|
@@ -3072,4 +3072,4 @@
|
|
|
3072
3072
|
height: ${15}px;
|
|
3073
3073
|
vertical-align: sub;
|
|
3074
3074
|
}
|
|
3075
|
-
`;class Df extends t.Component{constructor(e,s={}){super(e,s),this.model=new Ru(this.props.data,{notifyUser:e=>this.trigger("notify-user",{content:e}),askConfirmation:(e,t,s)=>this.trigger("ask-confirmation",{content:e,confirm:t,cancel:s}),editText:(e,t,s)=>this.trigger("edit-text",{title:e,placeholder:t,callback:s}),openSidePanel:(e,t={})=>this.openSidePanel(e,t),evalContext:{env:this.env},transportService:this.props.transportService,client:this.props.client,isReadonly:this.props.isReadonly,snapshotRequested:this.props.snapshotRequested},this.props.stateUpdateMessages),this.grid=Of("grid"),this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.linkEditor=t.useState({isOpen:!1}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.clipBoardString="",this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})},_f({openSidePanel:(e,t={})=>this.openSidePanel(e,t),toggleSidePanel:(e,t={})=>this.toggleSidePanel(e,t),dispatch:this.model.dispatch,getters:this.model.getters,uuidGenerator:this.model.uuidGenerator,_t:Df._t,clipboard:navigator.clipboard,export:this.model.exportData.bind(this.model),waitForIdle:this.model.waitForIdle.bind(this.model),exportXLSX:this.model.exportXLSX.bind(this.model),openLinkEditor:()=>this.openLinkEditor()}),Af(window,"resize",this.render),Af(document.body,"cut",this.copy.bind(this,!0)),Af(document.body,"copy",this.copy.bind(this,!1)),Af(document.body,"paste",this.paste),Af(document.body,"keyup",this.onKeyup.bind(this)),Af(window,"beforeunload",this.leaveCollaborativeSession.bind(this)),this.activateFirstSheet()}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}mounted(){this.model.on("update",this,this.render),this.model.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.props.client&&this.model.joinSession(this.props.client)}willUnmount(){this.leaveCollaborativeSession()}async willUpdateProps(e){this.props.isReadonly!==e.isReadonly&&this.model.updateReadOnly(e.isReadonly)}leaveCollaborativeSession(){this.model.off("update",this),this.model.leaveSession()}activateFirstSheet(){const e=this.model.getters.getActiveSheetId(),[t]=this.model.getters.getSheets();t.id!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:t.id})}destroy(){this.model.destroy(),super.destroy()}openSidePanel(e,t){this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid()}openLinkEditor(){this.linkEditor.isOpen=!0}closeLinkEditor(){this.linkEditor.isOpen=!1,this.focusGrid()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}copy(e,t){if(!this.grid.el.contains(document.activeElement))return;if("inactive"!==this.model.getters.getEditionMode())return;const s=e?"CUT":"COPY",i=this.model.getters.getSelectedZones();this.model.dispatch(s,{target:i});const o=this.model.getters.getClipboardContent();this.clipBoardString=o,t.clipboardData.setData("text/plain",o),t.preventDefault()}paste(e){if(!this.grid.el.contains(document.activeElement))return;const t=e.clipboardData;if(t.types.indexOf("text/plain")>-1){const e=t.getData("text/plain"),s=this.model.getters.getSelectedZones();this.clipBoardString===e?this.model.dispatch("PASTE",{target:s,interactive:!0}):this.model.dispatch("PASTE_FROM_OS_CLIPBOARD",{target:s,text:e})}}save(){this.trigger("save-content",{data:this.model.exportData()})}onKeyup(e){"Control"===e.key&&this.model.getters.getSelectionMode()!==Ch.expanding&&this.model.dispatch("STOP_SELECTION")}onKeydown(e){"Control"!==e.key||e.repeat||this.model.dispatch(this.model.getters.getSelectionMode()===Ch.idle?"PREPARE_SELECTION_EXPANSION":"START_SELECTION_EXPANSION");let t="";(e.ctrlKey||e.metaKey)&&(t+="CTRL+"),t+=e.key.toUpperCase();let s=this.keyDownMapping[t];if(s)return e.preventDefault(),e.stopPropagation(),void s()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerContentFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerCellFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}}Df.template=Ff,Df.style=$f,Df.components={TopBar:Mf,Grid:Jg,BottomBar:Xu,SidePanel:rf,LinkEditor:kg},Df._t=e=>e;const Pf={},Uf={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:f,HEADER_WIDTH:m,TOPBAR_HEIGHT:v,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:E,DEFAULT_CELL_HEIGHT:b,SCROLLBAR_WIDTH:S},Bf={autofillModifiersRegistry:wa,autofillRulesRegistry:xa,cellMenuRegistry:nl,colMenuRegistry:rl,linkMenuRegistry:al,functionRegistry:ir,uiPluginRegistry:sd,corePluginRegistry:td,rowMenuRegistry:ll,sidePanelRegistry:gh,sheetMenuRegistry:cl,topbarMenuRegistry:hl,topbarComponentRegistry:fh,otRegistry:dl,inverseCommandRegistry:Ra,cellRegistry:zr},Vf={LinkCell:Qr},Hf={args:Ae,toBoolean:pe,toNumber:ce,toString:de,toXC:ss,toZone:_s,toCartesian:ts,numberToLetters:es,createFullMenuItem:Aa,UuidGenerator:ti,formatDecimal:ne,computeTextWidth:gs,isMarkdownLink:Is,parseMarkdownLink:ws,markdownLink:ys,createEmptyWorkbookData:da};e.CorePlugin=pa,e.DATETIME_FORMAT=A,e.DataSource=nd,e.DispatchResult=Pe,e.Model=Ru,e.Revision=Wh,e.SPREADSHEET_DIMENSIONS=Uf,e.Spreadsheet=Df,e.UIPlugin=mh,e.__DEBUG__=Ms,e.__info__=Pf,e.astToFormula=Ar,e.cellTypes=Vf,e.convertAstNodes=Mr,e.coreTypes=$e,e.functionCache=$r,e.helpers=Hf,e.invalidateEvaluationCommands=ke,e.normalize=Vr,e.parse=Lr,e.readonlyAllowedCommands=Fe,e.registries=Bf,e.setTranslationMethod=function(e){o=e},Object.defineProperty(e,"__esModule",{value:!0}),Pf.version="15.0.
|
|
3075
|
+
`;class Df extends t.Component{constructor(e,s={}){super(e,s),this.model=new Ru(this.props.data,{notifyUser:e=>this.trigger("notify-user",{content:e}),askConfirmation:(e,t,s)=>this.trigger("ask-confirmation",{content:e,confirm:t,cancel:s}),editText:(e,t,s)=>this.trigger("edit-text",{title:e,placeholder:t,callback:s}),openSidePanel:(e,t={})=>this.openSidePanel(e,t),evalContext:{env:this.env},transportService:this.props.transportService,client:this.props.client,isReadonly:this.props.isReadonly,snapshotRequested:this.props.snapshotRequested},this.props.stateUpdateMessages),this.grid=Of("grid"),this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.linkEditor=t.useState({isOpen:!1}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.clipBoardString="",this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})},_f({openSidePanel:(e,t={})=>this.openSidePanel(e,t),toggleSidePanel:(e,t={})=>this.toggleSidePanel(e,t),dispatch:this.model.dispatch,getters:this.model.getters,uuidGenerator:this.model.uuidGenerator,_t:Df._t,clipboard:navigator.clipboard,export:this.model.exportData.bind(this.model),waitForIdle:this.model.waitForIdle.bind(this.model),exportXLSX:this.model.exportXLSX.bind(this.model),openLinkEditor:()=>this.openLinkEditor()}),Af(window,"resize",this.render),Af(document.body,"cut",this.copy.bind(this,!0)),Af(document.body,"copy",this.copy.bind(this,!1)),Af(document.body,"paste",this.paste),Af(document.body,"keyup",this.onKeyup.bind(this)),Af(window,"beforeunload",this.leaveCollaborativeSession.bind(this)),this.activateFirstSheet()}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}mounted(){this.model.on("update",this,this.render),this.model.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.props.client&&this.model.joinSession(this.props.client)}willUnmount(){this.leaveCollaborativeSession()}async willUpdateProps(e){this.props.isReadonly!==e.isReadonly&&this.model.updateReadOnly(e.isReadonly)}leaveCollaborativeSession(){this.model.off("update",this),this.model.leaveSession()}activateFirstSheet(){const e=this.model.getters.getActiveSheetId(),[t]=this.model.getters.getSheets();t.id!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:t.id})}destroy(){this.model.destroy(),super.destroy()}openSidePanel(e,t){this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid()}openLinkEditor(){this.linkEditor.isOpen=!0}closeLinkEditor(){this.linkEditor.isOpen=!1,this.focusGrid()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}copy(e,t){if(!this.grid.el.contains(document.activeElement))return;if("inactive"!==this.model.getters.getEditionMode())return;const s=e?"CUT":"COPY",i=this.model.getters.getSelectedZones();this.model.dispatch(s,{target:i});const o=this.model.getters.getClipboardContent();this.clipBoardString=o,t.clipboardData.setData("text/plain",o),t.preventDefault()}paste(e){if(!this.grid.el.contains(document.activeElement))return;const t=e.clipboardData;if(t.types.indexOf("text/plain")>-1){const e=t.getData("text/plain"),s=this.model.getters.getSelectedZones();this.clipBoardString===e?this.model.dispatch("PASTE",{target:s,interactive:!0}):this.model.dispatch("PASTE_FROM_OS_CLIPBOARD",{target:s,text:e})}}save(){this.trigger("save-content",{data:this.model.exportData()})}onKeyup(e){"Control"===e.key&&this.model.getters.getSelectionMode()!==Ch.expanding&&this.model.dispatch("STOP_SELECTION")}onKeydown(e){"Control"!==e.key||e.repeat||this.model.dispatch(this.model.getters.getSelectionMode()===Ch.idle?"PREPARE_SELECTION_EXPANSION":"START_SELECTION_EXPANSION");let t="";(e.ctrlKey||e.metaKey)&&(t+="CTRL+"),t+=e.key.toUpperCase();let s=this.keyDownMapping[t];if(s)return e.preventDefault(),e.stopPropagation(),void s()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerContentFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerCellFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent(e.detail||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}}Df.template=Ff,Df.style=$f,Df.components={TopBar:Mf,Grid:Jg,BottomBar:Xu,SidePanel:rf,LinkEditor:kg},Df._t=e=>e;const Pf={},Uf={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:f,HEADER_WIDTH:m,TOPBAR_HEIGHT:v,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:E,DEFAULT_CELL_HEIGHT:b,SCROLLBAR_WIDTH:S},Bf={autofillModifiersRegistry:wa,autofillRulesRegistry:xa,cellMenuRegistry:nl,colMenuRegistry:rl,linkMenuRegistry:al,functionRegistry:ir,uiPluginRegistry:sd,corePluginRegistry:td,rowMenuRegistry:ll,sidePanelRegistry:gh,sheetMenuRegistry:cl,topbarMenuRegistry:hl,topbarComponentRegistry:fh,otRegistry:dl,inverseCommandRegistry:Ra,cellRegistry:zr},Vf={LinkCell:Qr},Hf={args:Ae,toBoolean:pe,toNumber:ce,toString:de,toXC:ss,toZone:_s,toCartesian:ts,numberToLetters:es,createFullMenuItem:Aa,UuidGenerator:ti,formatDecimal:ne,computeTextWidth:gs,isMarkdownLink:Is,parseMarkdownLink:ws,markdownLink:ys,createEmptyWorkbookData:da};e.CorePlugin=pa,e.DATETIME_FORMAT=A,e.DataSource=nd,e.DispatchResult=Pe,e.Model=Ru,e.Revision=Wh,e.SPREADSHEET_DIMENSIONS=Uf,e.Spreadsheet=Df,e.UIPlugin=mh,e.__DEBUG__=Ms,e.__info__=Pf,e.astToFormula=Ar,e.cellTypes=Vf,e.convertAstNodes=Mr,e.coreTypes=$e,e.functionCache=$r,e.helpers=Hf,e.invalidateEvaluationCommands=ke,e.normalize=Vr,e.parse=Lr,e.readonlyAllowedCommands=Fe,e.registries=Bf,e.setTranslationMethod=function(e){o=e},Object.defineProperty(e,"__esModule",{value:!0}),Pf.version="15.0.9",Pf.date="2023-06-12T13:46:56.382Z",Pf.hash="40ae7eb"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|