Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 885590f

Browse files
committed
cambios de constantes
1 parent 59afc83 commit 885590f

File tree

5 files changed

+92
-82
lines changed

5 files changed

+92
-82
lines changed

dist/main.js

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
var obsidian = require('obsidian');
44

5-
/*! *****************************************************************************
6-
Copyright (c) Microsoft Corporation.
7-
8-
Permission to use, copy, modify, and/or distribute this software for any
9-
purpose with or without fee is hereby granted.
10-
11-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17-
PERFORMANCE OF THIS SOFTWARE.
18-
***************************************************************************** */
19-
20-
function __awaiter(thisArg, _arguments, P, generator) {
21-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22-
return new (P || (P = Promise))(function (resolve, reject) {
23-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26-
step((generator = generator.apply(thisArg, _arguments || [])).next());
27-
});
5+
/*! *****************************************************************************
6+
Copyright (c) Microsoft Corporation.
7+
8+
Permission to use, copy, modify, and/or distribute this software for any
9+
purpose with or without fee is hereby granted.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17+
PERFORMANCE OF THIS SOFTWARE.
18+
***************************************************************************** */
19+
20+
function __awaiter(thisArg, _arguments, P, generator) {
21+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22+
return new (P || (P = Promise))(function (resolve, reject) {
23+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26+
step((generator = generator.apply(thisArg, _arguments || [])).next());
27+
});
2828
}
2929

3030
/** Table Actions */
@@ -163,13 +163,12 @@ function obtainMetadataColumns() {
163163
isMetadata: true
164164
};
165165
metadataColumns[MetadataColumns.ADD_COLUMN] = {
166-
key: `${MetadataColumns.ADD_COLUMN}`,
167-
Header: `${MetadataColumns.ADD_COLUMN}`,
166+
key: MetadataColumns.ADD_COLUMN,
167+
Header: MetadataColumns.ADD_COLUMN,
168168
input: DataTypes.NEW_COLUMN,
169-
width: 20,
170169
disableResizing: true,
171170
label: '+',
172-
accessor: `${MetadataColumns.ADD_COLUMN}`,
171+
accessor: MetadataColumns.ADD_COLUMN,
173172
isMetadata: true
174173
};
175174
yield Promise.all(Object.keys(metadataColumns).map((columnKey, index) => __awaiter(this, void 0, void 0, function* () {
@@ -9847,19 +9846,19 @@ var initStateUpdates = function initStateUpdates() {
98479846
};
98489847

98499848
function connectAdvanced(
9850-
/*
9851-
selectorFactory is a func that is responsible for returning the selector function used to
9852-
compute new props from state, props, and dispatch. For example:
9853-
export default connectAdvanced((dispatch, options) => (state, props) => ({
9854-
thing: state.things[props.thingId],
9855-
saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
9856-
}))(YourComponent)
9857-
Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
9858-
outside of their selector as an optimization. Options passed to connectAdvanced are passed to
9859-
the selectorFactory, along with displayName and WrappedComponent, as the second argument.
9860-
Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
9861-
props. Do not use connectAdvanced directly without memoizing results between calls to your
9862-
selector, otherwise the Connect component will re-render on every state or props change.
9849+
/*
9850+
selectorFactory is a func that is responsible for returning the selector function used to
9851+
compute new props from state, props, and dispatch. For example:
9852+
export default connectAdvanced((dispatch, options) => (state, props) => ({
9853+
thing: state.things[props.thingId],
9854+
saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
9855+
}))(YourComponent)
9856+
Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
9857+
outside of their selector as an optimization. Options passed to connectAdvanced are passed to
9858+
the selectorFactory, along with displayName and WrappedComponent, as the second argument.
9859+
Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
9860+
props. Do not use connectAdvanced directly without memoizing results between calls to your
9861+
selector, otherwise the Connect component will re-render on every state or props change.
98639862
*/
98649863
selectorFactory, // options object:
98659864
_ref) {
@@ -10145,9 +10144,9 @@ function bindActionCreators(actionCreators, dispatch) {
1014510144
return boundActionCreators;
1014610145
}
1014710146

10148-
/**
10149-
* @param {any} obj The object to inspect.
10150-
* @returns {boolean} True if the argument appears to be a plain object.
10147+
/**
10148+
* @param {any} obj The object to inspect.
10149+
* @returns {boolean} True if the argument appears to be a plain object.
1015110150
*/
1015210151
function isPlainObject(obj) {
1015310152
if (typeof obj !== 'object' || obj === null) return false;
@@ -10162,11 +10161,11 @@ function isPlainObject(obj) {
1016210161
return proto === baseProto;
1016310162
}
1016410163

10165-
/**
10166-
* Prints a warning in the console if it exists.
10167-
*
10168-
* @param {String} message The warning message.
10169-
* @returns {void}
10164+
/**
10165+
* Prints a warning in the console if it exists.
10166+
*
10167+
* @param {String} message The warning message.
10168+
* @returns {void}
1017010169
*/
1017110170
function warning$1(message) {
1017210171
/* eslint-disable no-console */
@@ -10423,21 +10422,21 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
1042310422
}
1042410423

1042510424
var _excluded = ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"];
10426-
/*
10427-
connect is a facade over connectAdvanced. It turns its args into a compatible
10428-
selectorFactory, which has the signature:
10429-
10430-
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
10431-
10432-
connect passes its args to connectAdvanced as options, which will in turn pass them to
10433-
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
10434-
10435-
selectorFactory returns a final props selector from its mapStateToProps,
10436-
mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
10437-
mergePropsFactories, and pure args.
10438-
10439-
The resulting final props selector is called by the Connect component instance whenever
10440-
it receives new props or store state.
10425+
/*
10426+
connect is a facade over connectAdvanced. It turns its args into a compatible
10427+
selectorFactory, which has the signature:
10428+
10429+
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
10430+
10431+
connect passes its args to connectAdvanced as options, which will in turn pass them to
10432+
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
10433+
10434+
selectorFactory returns a final props selector from its mapStateToProps,
10435+
mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
10436+
mergePropsFactories, and pure args.
10437+
10438+
The resulting final props selector is called by the Connect component instance whenever
10439+
it receives new props or store state.
1044110440
*/
1044210441

1044310442
function match(arg, factories, name) {
@@ -46965,14 +46964,14 @@ Object.defineProperty(lib, '__esModule', { value: true });
4696546964

4696646965

4696746966

46968-
// UTIL FUNCTIONS
46969-
const getAPI = (app) => {
46970-
var _a;
46971-
if (app)
46972-
return (_a = app.plugins.plugins.dataview) === null || _a === void 0 ? void 0 : _a.api;
46973-
else
46974-
return window["DataviewAPI"];
46975-
};
46967+
// UTIL FUNCTIONS
46968+
const getAPI = (app) => {
46969+
var _a;
46970+
if (app)
46971+
return (_a = app.plugins.plugins.dataview) === null || _a === void 0 ? void 0 : _a.api;
46972+
else
46973+
return window["DataviewAPI"];
46974+
};
4697646975
const isPluginEnabled = (app) => app.plugins.enabledPlugins.has("dataview");
4697746976

4697846977
var getAPI_1 = lib.getAPI = getAPI;

src/components/Columns.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ export async function obtainMetadataColumns(): Promise<TableColumn[]> {
1313
const columns:TableColumn[] = [];
1414
const metadataColumns: Record<string, DatabaseColumn> = {};
1515
metadataColumns[MetadataColumns.FILE]={
16-
key: `${MetadataColumns.FILE}`,
16+
key: MetadataColumns.FILE,
1717
input: DataTypes.MARKDOWN,
18-
Header: `${MetadataColumns.FILE}`,
18+
Header: MetadataColumns.FILE,
1919
label: MetadataLabels.FILE,
20-
accessor: `${MetadataColumns.FILE}`,
20+
accessor: MetadataColumns.FILE,
2121
isMetadata: true
2222
};
2323

2424
metadataColumns[MetadataColumns.ADD_COLUMN]={
25-
key: `${MetadataColumns.ADD_COLUMN}`,
26-
Header: `${MetadataColumns.ADD_COLUMN}`,
25+
key: MetadataColumns.ADD_COLUMN,
26+
Header: MetadataColumns.ADD_COLUMN,
2727
input: DataTypes.NEW_COLUMN,
2828
width: 20,
2929
disableResizing: true,
3030
label: '+',
31-
accessor: `${MetadataColumns.ADD_COLUMN}`,
31+
accessor: MetadataColumns.ADD_COLUMN,
3232
isMetadata: true
3333
}
3434

src/components/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TextIcon from 'components/img/Text';
1010
import MultiIcon from 'components/img/Multi';
1111
import HashIcon from 'components/img/Hash';
1212
import PlusIcon from 'components/img/Plus';
13-
import { ActionTypes, DataTypes, MAX_CAPACITY_DATABASE } from 'helpers/Constants';
13+
import { ActionTypes, DataTypes, MAX_CAPACITY_DATABASE, MetadataColumns } from 'helpers/Constants';
1414
import { LOGGER } from 'services/Logger';
1515
import { DatabaseHeaderProps } from 'cdm/FolderModel';
1616
import ReactDOM from 'react-dom';
@@ -194,7 +194,7 @@ export default function Header(headerProps:DatabaseHeaderProps) {
194194
}
195195

196196
function handlerAddColumnToLeft(e:any) {
197-
dataDispatch({type: ActionTypes.ADD_COLUMN_TO_LEFT, columnId: 999999, focus: true})
197+
dataDispatch({type: ActionTypes.ADD_COLUMN_TO_LEFT, columnId: MetadataColumns.ADD_COLUMN, focus: true})
198198
}
199199

200200
/**
@@ -290,7 +290,7 @@ export default function Header(headerProps:DatabaseHeaderProps) {
290290
);
291291
}
292292
LOGGER.debug(`<=Header ${headerProps.column.label}`);
293-
return id !== `${MAX_CAPACITY_DATABASE}` ? (
293+
return id !== MetadataColumns.ADD_COLUMN ? (
294294
<>
295295
<div className='th-content' onClick={() => setExpanded(true)} ref={setReferenceElement}>
296296
<span className='svg-icon svg-gray icon-margin'>{propertyIcon}</span>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const getColumnWidthStyle = (rows:any, accessor:any, headerText:string) => {
2+
const maxWidth = 400
3+
const magicSpacing = 10
4+
const cellLength = Math.max(
5+
...rows.map((row:any) => (`${row[accessor]}` || '').length),
6+
headerText.length,
7+
)
8+
return Math.min(maxWidth, cellLength * magicSpacing)
9+
}
10+
11+
export default getColumnWidthStyle;

src/helpers/Constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const DataTypes = Object.freeze({
2222
export const MAX_CAPACITY_DATABASE = 999999;
2323

2424
export const MetadataColumns = Object.freeze({
25-
FILE: MAX_CAPACITY_DATABASE-1,
26-
ADD_COLUMN: MAX_CAPACITY_DATABASE
25+
FILE: `${MAX_CAPACITY_DATABASE-1}`,
26+
ADD_COLUMN: `${MAX_CAPACITY_DATABASE}`
2727
});
2828

2929
export const MetadataLabels = Object.freeze({

0 commit comments

Comments
 (0)