kui-crm 0.0.222 → 0.0.224

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/cjs/index.js CHANGED
@@ -4368,13 +4368,23 @@ var useMetroBlock = function (form, mapStore, metroStore, coords) {
4368
4368
  control: form.control,
4369
4369
  name: "metroStations",
4370
4370
  }), fields = _b.fields, append = _b.append, remove = _b.remove, update = _b.update, replace = _b.replace;
4371
- var addMap = function () {
4372
- if (!map) {
4373
- var div = document.createElement("div");
4374
- var createdMap = new window.google.maps.Map(div);
4375
- setMap(createdMap);
4376
- }
4377
- };
4371
+ var addMap = function () { return __awaiter(void 0, void 0, void 0, function () {
4372
+ var div, Map_1, createdMap;
4373
+ return __generator(this, function (_a) {
4374
+ switch (_a.label) {
4375
+ case 0:
4376
+ if (!!map) return [3 /*break*/, 2];
4377
+ div = document.createElement("div");
4378
+ return [4 /*yield*/, window.google.maps.importLibrary("maps")];
4379
+ case 1:
4380
+ Map_1 = (_a.sent()).Map;
4381
+ createdMap = new Map_1(div);
4382
+ setMap(createdMap);
4383
+ _a.label = 2;
4384
+ case 2: return [2 /*return*/];
4385
+ }
4386
+ });
4387
+ }); };
4378
4388
  var checkMapLoaded = function () {
4379
4389
  if (!window.google) {
4380
4390
  setTimeout(checkMapLoaded, 1);
@@ -4472,8 +4482,8 @@ var StyledInputWrapper = styled__default["default"].div(templateObject_1$3 || (t
4472
4482
  var templateObject_1$3;
4473
4483
 
4474
4484
  var MetroBlockHeader = function (props) {
4475
- var addMetro = props.addMetro, updateMetroStations = props.updateMetroStations, label = props.label;
4476
- return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsxs(StyledWrapper$1, __assign({ container: true, alignItems: "center", justify: "space-between" }, { children: [jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", weight: 600 }, { children: (label || "METRO").toUpperCase() })), jsxRuntime.jsxs(StyledButtonsWrapper, __assign({ container: true, wrap: "nowrap" }, { children: [jsxRuntime.jsx(kuiBasic.Button, __assign({ isCircle: true, size: "xs", variant: "grayLight", onClick: updateMetroStations }, { children: jsxRuntime.jsx(kuiIcon.UpdateIcon, {}) })), jsxRuntime.jsx(kuiBasic.Button, __assign({ isCircle: true, size: "xs", variant: "grayLight", onClick: addMetro }, { children: jsxRuntime.jsx(kuiIcon.PlusIcon, { width: 14, height: 14 }) }))] }))] })) })));
4485
+ var addMetro = props.addMetro, updateMetroStations = props.updateMetroStations, label = props.label, disabled = props.disabled;
4486
+ return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true, xs: 12 }, { children: jsxRuntime.jsxs(StyledWrapper$1, __assign({ container: true, alignItems: "center", justify: "space-between" }, { children: [jsxRuntime.jsx(kuiBasic.Caption, __assign({ size: "xs", weight: 600 }, { children: (label || "METRO").toUpperCase() })), jsxRuntime.jsxs(StyledButtonsWrapper, __assign({ container: true, wrap: "nowrap" }, { children: [jsxRuntime.jsx(kuiBasic.Button, __assign({ isCircle: true, size: "xs", variant: "grayLight", onClick: updateMetroStations, disabled: disabled }, { children: jsxRuntime.jsx(kuiIcon.UpdateIcon, {}) })), jsxRuntime.jsx(kuiBasic.Button, __assign({ isCircle: true, size: "xs", variant: "grayLight", onClick: addMetro, disabled: disabled }, { children: jsxRuntime.jsx(kuiIcon.PlusIcon, { width: 14, height: 14 }) }))] }))] })) })));
4477
4487
  };
4478
4488
  var StyledWrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n margin-bottom: 16px;\n margin-top: 8px;\n"], ["\n margin-bottom: 16px;\n margin-top: 8px;\n"])));
4479
4489
  var StyledButtonsWrapper = styled__default["default"](kuiBasic.Grid)(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n width: fit-content;\n > button:first-of-type {\n margin-right: 16px;\n }\n"], ["\n width: fit-content;\n > button:first-of-type {\n margin-right: 16px;\n }\n"])));
@@ -4482,7 +4492,7 @@ var templateObject_1$2, templateObject_2$1;
4482
4492
  function MetroBlockForModal(props) {
4483
4493
  var form = props.form, isEditing = props.isEditing, coords = props.coords, metroStore = props.metroStore, mapStore = props.mapStore, fieldsSettings = props.fieldsSettings, label = props.label;
4484
4494
  var _a = useMetroBlock(form, mapStore, metroStore, coords), fields = _a.fields, isLoading = _a.isLoading, remove = _a.remove, update = _a.update, updateMetroStations = _a.updateMetroStations, addMetro = _a.addMetro;
4485
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MetroBlockHeader, { addMetro: addMetro, updateMetroStations: updateMetroStations, label: label }), jsxRuntime.jsx(kuiBasic.Grid, __assign({ container: true, spacing: 3 }, { children: fields.map(function (item, index) { return (jsxRuntime.jsx(MetroItem$1, { index: index, form: form, isEditing: isEditing, onDelete: remove, apartmentCoords: coords, onChange: update, metroStore: metroStore, fieldsSettings: fieldsSettings }, fields[index].id)); }) })), isLoading && jsxRuntime.jsx(LoaderPopup, { label: "metro changes" })] }));
4495
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MetroBlockHeader, { addMetro: addMetro, updateMetroStations: updateMetroStations, label: label, disabled: !isEditing }), jsxRuntime.jsx(kuiBasic.Grid, __assign({ container: true, spacing: 3 }, { children: fields.map(function (item, index) { return (jsxRuntime.jsx(MetroItem$1, { index: index, form: form, isEditing: isEditing, onDelete: remove, apartmentCoords: coords, onChange: update, metroStore: metroStore, fieldsSettings: fieldsSettings }, fields[index].id)); }) })), isLoading && jsxRuntime.jsx(LoaderPopup, { label: "metro changes" })] }));
4486
4496
  }
4487
4497
  var index$1 = mobxReact.observer(MetroBlockForModal);
4488
4498