@teselagen/ui 0.6.1 → 0.6.3
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/TgSelect/index.d.ts +0 -1
- package/index.cjs.js +25 -15
- package/index.es.js +26 -16
- package/package.json +1 -1
- package/src/TgSelect/index.js +22 -12
package/TgSelect/index.d.ts
CHANGED
|
@@ -6,5 +6,4 @@ export function createNewOption(newValString: any): {
|
|
|
6
6
|
export function simplesearch(needle: any, haystack: any): boolean;
|
|
7
7
|
declare function _default(props: any): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default _default;
|
|
9
|
-
export function renderCreateNewOption(query: any, active: any, handleClick: any): import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export function itemListPredicate(_queryString: string | undefined, items: any, isSimpleSearch: any): any;
|
package/index.cjs.js
CHANGED
|
@@ -37076,6 +37076,28 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37076
37076
|
}
|
|
37077
37077
|
return optionRenderer;
|
|
37078
37078
|
}, "getOptionRenderer"));
|
|
37079
|
+
__publicField(this, "renderCreateNewOption", /* @__PURE__ */ __name((query, active3, handleClick) => {
|
|
37080
|
+
if (this.props.renderCreateNewOption) {
|
|
37081
|
+
return this.props.renderCreateNewOption(query, active3, handleClick);
|
|
37082
|
+
}
|
|
37083
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
37084
|
+
core.MenuItem,
|
|
37085
|
+
{
|
|
37086
|
+
icon: "add",
|
|
37087
|
+
text: `Create "${query}"`,
|
|
37088
|
+
active: active3,
|
|
37089
|
+
onClick: (...args) => {
|
|
37090
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
37091
|
+
if (shouldStopEarly) {
|
|
37092
|
+
this.setOpenState(false);
|
|
37093
|
+
} else {
|
|
37094
|
+
handleClick(...args);
|
|
37095
|
+
}
|
|
37096
|
+
},
|
|
37097
|
+
shouldDismissPopover: false
|
|
37098
|
+
}
|
|
37099
|
+
);
|
|
37100
|
+
}, "renderCreateNewOption"));
|
|
37079
37101
|
const { autoOpen = false } = this.props;
|
|
37080
37102
|
this.state = {
|
|
37081
37103
|
isOpen: autoOpen,
|
|
@@ -37111,8 +37133,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37111
37133
|
disabled,
|
|
37112
37134
|
popoverProps,
|
|
37113
37135
|
additionalRightEl,
|
|
37114
|
-
resetOnSelect = true
|
|
37115
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption$1
|
|
37136
|
+
resetOnSelect = true
|
|
37116
37137
|
} = _a2, rest = __objRest(_a2, [
|
|
37117
37138
|
"multi",
|
|
37118
37139
|
"asTag",
|
|
@@ -37140,8 +37161,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37140
37161
|
"disabled",
|
|
37141
37162
|
"popoverProps",
|
|
37142
37163
|
"additionalRightEl",
|
|
37143
|
-
"resetOnSelect"
|
|
37144
|
-
"renderCreateNewOption"
|
|
37164
|
+
"resetOnSelect"
|
|
37145
37165
|
]);
|
|
37146
37166
|
if (asTag) {
|
|
37147
37167
|
small = true;
|
|
@@ -37180,7 +37200,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37180
37200
|
}
|
|
37181
37201
|
));
|
|
37182
37202
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : void 0;
|
|
37183
|
-
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ?
|
|
37203
|
+
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ? this.renderCreateNewOption : null;
|
|
37184
37204
|
const selectedItems = getValueArray(value).map((value2) => {
|
|
37185
37205
|
if (value2 && value2.label)
|
|
37186
37206
|
return value2;
|
|
@@ -37319,16 +37339,6 @@ const TgSelect$1 = redux.compose(
|
|
|
37319
37339
|
)(TgSelect);
|
|
37320
37340
|
const itemDisabled = /* @__PURE__ */ __name((i) => i.disabled, "itemDisabled");
|
|
37321
37341
|
const noResultsDefault = /* @__PURE__ */ React$1.createElement("div", null, "No Results...");
|
|
37322
|
-
const renderCreateNewOption$1 = /* @__PURE__ */ __name((query, active3, handleClick) => /* @__PURE__ */ React$1.createElement(
|
|
37323
|
-
core.MenuItem,
|
|
37324
|
-
{
|
|
37325
|
-
icon: "add",
|
|
37326
|
-
text: `Create "${query}"`,
|
|
37327
|
-
active: active3,
|
|
37328
|
-
onClick: handleClick,
|
|
37329
|
-
shouldDismissPopover: false
|
|
37330
|
-
}
|
|
37331
|
-
), "renderCreateNewOption$1");
|
|
37332
37342
|
function createNewOption(newValString) {
|
|
37333
37343
|
if (!newValString)
|
|
37334
37344
|
return;
|
package/index.es.js
CHANGED
|
@@ -58,7 +58,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
58
58
|
};
|
|
59
59
|
import * as React$1 from "react";
|
|
60
60
|
import React__default, { useState, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, memo, Component, PureComponent, createElement, useLayoutEffect, createContext, useContext, isValidElement } from "react";
|
|
61
|
-
import { Icon, Classes, Button, Intent,
|
|
61
|
+
import { Icon, Classes, Button, Intent, MenuItem, Keys, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
|
|
62
62
|
import ReactDOM, { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
63
63
|
import { FormName, formValueSelector, change, Field, reduxForm, SubmissionError, destroy, initialize, Fields } from "redux-form";
|
|
64
64
|
import { connect, useStore } from "react-redux";
|
|
@@ -37058,6 +37058,28 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37058
37058
|
}
|
|
37059
37059
|
return optionRenderer;
|
|
37060
37060
|
}, "getOptionRenderer"));
|
|
37061
|
+
__publicField(this, "renderCreateNewOption", /* @__PURE__ */ __name((query, active3, handleClick) => {
|
|
37062
|
+
if (this.props.renderCreateNewOption) {
|
|
37063
|
+
return this.props.renderCreateNewOption(query, active3, handleClick);
|
|
37064
|
+
}
|
|
37065
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
37066
|
+
MenuItem,
|
|
37067
|
+
{
|
|
37068
|
+
icon: "add",
|
|
37069
|
+
text: `Create "${query}"`,
|
|
37070
|
+
active: active3,
|
|
37071
|
+
onClick: (...args) => {
|
|
37072
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
37073
|
+
if (shouldStopEarly) {
|
|
37074
|
+
this.setOpenState(false);
|
|
37075
|
+
} else {
|
|
37076
|
+
handleClick(...args);
|
|
37077
|
+
}
|
|
37078
|
+
},
|
|
37079
|
+
shouldDismissPopover: false
|
|
37080
|
+
}
|
|
37081
|
+
);
|
|
37082
|
+
}, "renderCreateNewOption"));
|
|
37061
37083
|
const { autoOpen = false } = this.props;
|
|
37062
37084
|
this.state = {
|
|
37063
37085
|
isOpen: autoOpen,
|
|
@@ -37093,8 +37115,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37093
37115
|
disabled,
|
|
37094
37116
|
popoverProps,
|
|
37095
37117
|
additionalRightEl,
|
|
37096
|
-
resetOnSelect = true
|
|
37097
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption$1
|
|
37118
|
+
resetOnSelect = true
|
|
37098
37119
|
} = _a2, rest = __objRest(_a2, [
|
|
37099
37120
|
"multi",
|
|
37100
37121
|
"asTag",
|
|
@@ -37122,8 +37143,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37122
37143
|
"disabled",
|
|
37123
37144
|
"popoverProps",
|
|
37124
37145
|
"additionalRightEl",
|
|
37125
|
-
"resetOnSelect"
|
|
37126
|
-
"renderCreateNewOption"
|
|
37146
|
+
"resetOnSelect"
|
|
37127
37147
|
]);
|
|
37128
37148
|
if (asTag) {
|
|
37129
37149
|
small = true;
|
|
@@ -37162,7 +37182,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37162
37182
|
}
|
|
37163
37183
|
));
|
|
37164
37184
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : void 0;
|
|
37165
|
-
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ?
|
|
37185
|
+
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ? this.renderCreateNewOption : null;
|
|
37166
37186
|
const selectedItems = getValueArray(value).map((value2) => {
|
|
37167
37187
|
if (value2 && value2.label)
|
|
37168
37188
|
return value2;
|
|
@@ -37301,16 +37321,6 @@ const TgSelect$1 = compose$1(
|
|
|
37301
37321
|
)(TgSelect);
|
|
37302
37322
|
const itemDisabled = /* @__PURE__ */ __name((i) => i.disabled, "itemDisabled");
|
|
37303
37323
|
const noResultsDefault = /* @__PURE__ */ React__default.createElement("div", null, "No Results...");
|
|
37304
|
-
const renderCreateNewOption$1 = /* @__PURE__ */ __name((query, active3, handleClick) => /* @__PURE__ */ React__default.createElement(
|
|
37305
|
-
MenuItem,
|
|
37306
|
-
{
|
|
37307
|
-
icon: "add",
|
|
37308
|
-
text: `Create "${query}"`,
|
|
37309
|
-
active: active3,
|
|
37310
|
-
onClick: handleClick,
|
|
37311
|
-
shouldDismissPopover: false
|
|
37312
|
-
}
|
|
37313
|
-
), "renderCreateNewOption$1");
|
|
37314
37324
|
function createNewOption(newValString) {
|
|
37315
37325
|
if (!newValString)
|
|
37316
37326
|
return;
|
package/package.json
CHANGED
package/src/TgSelect/index.js
CHANGED
|
@@ -221,6 +221,27 @@ class TgSelect extends React.Component {
|
|
|
221
221
|
}
|
|
222
222
|
return optionRenderer;
|
|
223
223
|
};
|
|
224
|
+
renderCreateNewOption = (query, active, handleClick) => {
|
|
225
|
+
if (this.props.renderCreateNewOption) {
|
|
226
|
+
return this.props.renderCreateNewOption(query, active, handleClick);
|
|
227
|
+
}
|
|
228
|
+
return (
|
|
229
|
+
<MenuItem
|
|
230
|
+
icon="add"
|
|
231
|
+
text={`Create "${query}"`}
|
|
232
|
+
active={active}
|
|
233
|
+
onClick={(...args) => {
|
|
234
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
235
|
+
if (shouldStopEarly) {
|
|
236
|
+
this.setOpenState(false);
|
|
237
|
+
} else {
|
|
238
|
+
handleClick(...args);
|
|
239
|
+
}
|
|
240
|
+
}}
|
|
241
|
+
shouldDismissPopover={false}
|
|
242
|
+
/>
|
|
243
|
+
);
|
|
244
|
+
};
|
|
224
245
|
|
|
225
246
|
render() {
|
|
226
247
|
let {
|
|
@@ -250,7 +271,6 @@ class TgSelect extends React.Component {
|
|
|
250
271
|
popoverProps,
|
|
251
272
|
additionalRightEl,
|
|
252
273
|
resetOnSelect = true,
|
|
253
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption,
|
|
254
274
|
...rest
|
|
255
275
|
} = this.props;
|
|
256
276
|
if (asTag) {
|
|
@@ -304,7 +324,7 @@ class TgSelect extends React.Component {
|
|
|
304
324
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : undefined;
|
|
305
325
|
const maybeCreateNewItemRenderer =
|
|
306
326
|
creatable && !this.queryHasExactOptionMatch()
|
|
307
|
-
?
|
|
327
|
+
? this.renderCreateNewOption
|
|
308
328
|
: null;
|
|
309
329
|
const selectedItems = getValueArray(value).map(value => {
|
|
310
330
|
if (value && value.label) return value; //if the value has a label, just use that
|
|
@@ -458,16 +478,6 @@ export default compose(
|
|
|
458
478
|
const itemDisabled = i => i.disabled;
|
|
459
479
|
const noResultsDefault = <div>No Results...</div>;
|
|
460
480
|
|
|
461
|
-
export const renderCreateNewOption = (query, active, handleClick) => (
|
|
462
|
-
<MenuItem
|
|
463
|
-
icon="add"
|
|
464
|
-
text={`Create "${query}"`}
|
|
465
|
-
active={active}
|
|
466
|
-
onClick={handleClick}
|
|
467
|
-
shouldDismissPopover={false}
|
|
468
|
-
/>
|
|
469
|
-
);
|
|
470
|
-
|
|
471
481
|
export function createNewOption(newValString) {
|
|
472
482
|
if (!newValString) return;
|
|
473
483
|
return {
|