@get-set/gs-sortable 0.0.21 → 0.0.23

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.
Files changed (53) hide show
  1. package/dist/actions/calculate.d.ts +3 -0
  2. package/dist/actions/calculate.js +132 -133
  3. package/dist/actions/calculate.js.map +1 -0
  4. package/dist/actions/calculateOnSort.d.ts +3 -0
  5. package/dist/actions/calculateOnSort.js +141 -239
  6. package/dist/actions/calculateOnSort.js.map +1 -0
  7. package/dist/actions/checkItemInContainer.d.ts +2 -0
  8. package/dist/actions/checkItemInContainer.js +24 -24
  9. package/dist/actions/checkItemInContainer.js.map +1 -0
  10. package/dist/actions/destroy.d.ts +9 -0
  11. package/dist/actions/destroy.js +25 -31
  12. package/dist/actions/destroy.js.map +1 -0
  13. package/dist/actions/general.d.ts +13 -0
  14. package/dist/actions/general.js +56 -83
  15. package/dist/actions/general.js.map +1 -0
  16. package/dist/actions/getCurrentParams.d.ts +9 -0
  17. package/dist/actions/getCurrentParams.js +25 -33
  18. package/dist/actions/getCurrentParams.js.map +1 -0
  19. package/dist/actions/init.d.ts +3 -0
  20. package/dist/actions/init.js +24 -30
  21. package/dist/actions/init.js.map +1 -0
  22. package/dist/actions/initDraggable.d.ts +3 -0
  23. package/dist/actions/initDraggable.js +80 -85
  24. package/dist/actions/initDraggable.js.map +1 -0
  25. package/dist/actions/initMouseMove.d.ts +2 -0
  26. package/dist/actions/initMouseMove.js +104 -97
  27. package/dist/actions/initMouseMove.js.map +1 -0
  28. package/dist/actions/initScroll.d.ts +2 -0
  29. package/dist/actions/initScroll.js +22 -24
  30. package/dist/actions/initScroll.js.map +1 -0
  31. package/dist/actions/initSortEnd.d.ts +2 -0
  32. package/dist/actions/initSortEnd.js +71 -68
  33. package/dist/actions/initSortEnd.js.map +1 -0
  34. package/dist/components/GSSortable.d.ts +24 -0
  35. package/dist/components/GSSortable.js +127 -164
  36. package/dist/components/GSSortable.js.map +1 -0
  37. package/dist/constants/constParams.d.ts +4 -0
  38. package/dist/constants/constParams.js +5 -8
  39. package/dist/constants/constParams.js.map +1 -0
  40. package/dist/constants/defaultParams.d.ts +3 -0
  41. package/dist/constants/defaultParams.js +21 -22
  42. package/dist/constants/defaultParams.js.map +1 -0
  43. package/dist/constants/types.d.ts +6 -0
  44. package/dist/constants/types.js +7 -10
  45. package/dist/constants/types.js.map +1 -0
  46. package/dist/helpers/uihelpers.d.ts +4 -0
  47. package/dist/helpers/uihelpers.js +47 -51
  48. package/dist/helpers/uihelpers.js.map +1 -0
  49. package/package.json +3 -2
  50. package/dist/actions/afterAllImagesLoad.js +0 -53
  51. package/dist/components/styles/GSSortable.css +0 -39
  52. package/dist/components/styles/GSSortable.css.map +0 -1
  53. package/dist/components/styles/GSSortable.scss +0 -37
@@ -1,172 +1,135 @@
1
1
  "use strict";
2
-
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
6
17
  });
7
- exports["default"] = void 0;
8
- var _react = require("react");
9
- var _getCurrentParams = _interopRequireDefault(require("../actions/getCurrentParams"));
10
- var _init = _interopRequireDefault(require("../actions/init"));
11
- var _destroy2 = _interopRequireDefault(require("../actions/destroy"));
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _defaultParams = _interopRequireDefault(require("../constants/defaultParams"));
14
- var _initMouseMove = _interopRequireDefault(require("../actions/initMouseMove"));
15
- var _initSortEnd = _interopRequireDefault(require("../actions/initSortEnd"));
16
- var _initScroll = _interopRequireDefault(require("../actions/initScroll"));
17
- var _types = _interopRequireDefault(require("../constants/types"));
18
- require("./styles/GSSortable.css");
19
- var _uihelpers = require("../helpers/uihelpers");
20
- var _excluded = ["children"];
21
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
23
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
24
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
26
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
27
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
28
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
29
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
31
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
32
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
33
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
34
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
35
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
36
- var params = {
37
- reference: _propTypes["default"].string,
38
- handler: _propTypes["default"].string,
39
- className: _propTypes["default"].string,
40
- afterSort: _propTypes["default"].func,
41
- gsx: _propTypes["default"].object,
42
- gap: _propTypes["default"].string,
43
- allowOutOfBox: _propTypes["default"].bool,
44
- count: _propTypes["default"].number,
45
- type: _propTypes["default"].oneOf([_types["default"].column, _types["default"].row, _types["default"].grid])
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
38
  };
47
-
48
- /**
49
- * GSSortable component to display a customizable sortable.
50
- *
51
- * @component
52
- * @param {Object} props - The props object.
53
- * @param {string} props.reference - Unique key for each sortable.
54
- * @param {boolean} props.className - Enable add classes.
55
- * @param {React.CSSProperties & Record<string, React.CSSProperties | Record<string, React.CSSProperties | Record<string, React.CSSProperties | Record<string, React.CSSProperties>>>} props.gsx
56
- * @param {string} props.gap - Allows set gap among elements.
57
- * @param {func} props.afterSort - this is callback function which called after sort.
58
- * @param {string} props.handler - selector of target element to move.
59
- * @param {number} props.count - Shows items count per row.
60
- * @param {'row' | 'column' | 'grid'} props.type - this is the type of prop.
61
- * @param {Array<Object>} [props.acceptFrom] - Array of that GSSortable references which can accept element from this.
62
- * @param {Array<Object>} [props.responsive] - Array of responsive configurations based on window size.
63
- * @param {number} props.responsive[].windowSize - Minimum window size for this configuration.
64
- * @param {Object} props.responsive[].params - The responsive configuration for the grid.
65
- * @returns {JSX.Element} The rendered sortable component.
66
- */
67
-
68
- var GSSortable = function GSSortable(_ref) {
69
- var children = _ref.children,
70
- rest = _objectWithoutProperties(_ref, _excluded);
71
- var params = _objectSpread({}, rest);
72
- var _useState = (0, _react.useState)(null),
73
- _useState2 = _slicedToArray(_useState, 2),
74
- componentKey = _useState2[0],
75
- setComponentKey = _useState2[1];
76
- var gridRef = (0, _react.useRef)(null);
77
- (0, _react.useEffect)(function () {
78
- if (componentKey != null) {
79
- if (typeof window.GSSortableConfigue === 'undefined') {
80
- window.GSSortableConfigue = {
81
- references: [],
82
- instance: function instance(ref) {
83
- if (ref != undefined && ref != '') {
84
- var instance = window.GSSortableConfigue.references.find(function (x) {
85
- return x.key === ref;
86
- });
87
- if (instance != undefined) {
88
- return instance.ref;
89
- }
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const react_1 = __importStar(require("react"));
41
+ const getCurrentParams_1 = __importDefault(require("../actions/getCurrentParams"));
42
+ const init_1 = __importDefault(require("../actions/init"));
43
+ const destroy_1 = __importDefault(require("../actions/destroy"));
44
+ const defaultParams_1 = __importDefault(require("../constants/defaultParams"));
45
+ const initMouseMove_1 = __importDefault(require("../actions/initMouseMove"));
46
+ const initSortEnd_1 = __importDefault(require("../actions/initSortEnd"));
47
+ const initScroll_1 = __importDefault(require("../actions/initScroll"));
48
+ require("./styles/GSSortable.css");
49
+ const uihelpers_1 = require("../helpers/uihelpers");
50
+ const GSSortable = (_a) => {
51
+ var { children } = _a, rest = __rest(_a, ["children"]);
52
+ const params = Object.assign({}, rest);
53
+ const [componentKey, setComponentKey] = (0, react_1.useState)(null);
54
+ const gridRef = (0, react_1.useRef)(null);
55
+ (0, react_1.useEffect)(() => {
56
+ var _a;
57
+ if (componentKey != null) {
58
+ if (typeof window.GSSortableConfigue === 'undefined') {
59
+ window.GSSortableConfigue = {
60
+ references: [],
61
+ instance: (ref) => {
62
+ var _a;
63
+ if (ref) {
64
+ const instance = (_a = window.GSSortableConfigue) === null || _a === void 0 ? void 0 : _a.references.find(x => x.key === ref);
65
+ if (instance) {
66
+ return instance.ref;
67
+ }
68
+ }
69
+ },
70
+ };
71
+ window.addEventListener('mousemove', e => {
72
+ (0, initMouseMove_1.default)(e);
73
+ });
74
+ window.addEventListener('mouseup', e => {
75
+ (0, initSortEnd_1.default)(e);
76
+ });
77
+ window.addEventListener('scroll', () => {
78
+ (0, initScroll_1.default)();
79
+ });
90
80
  }
91
- }
92
- };
93
- window.addEventListener('mousemove', function (e) {
94
- (0, _initMouseMove["default"])(e);
95
- });
96
- window.addEventListener('mouseup', function (e) {
97
- (0, _initSortEnd["default"])(e);
98
- });
99
- window.addEventListener('scroll', function () {
100
- (0, _initScroll["default"])();
101
- });
102
- }
103
- if (window.GSSortableConfigue.references.find(function (x) {
104
- return x.key === componentKey;
105
- }) === undefined) {
106
- var currentParams = (0, _getCurrentParams["default"])(params);
107
- window.GSSortableConfigue.references.push({
108
- key: componentKey,
109
- ref: {
110
- isAddjusting: false,
111
- grid: gridRef.current,
112
- currentParams: _objectSpread(_objectSpread({}, currentParams), {}, {
113
- reference: componentKey
114
- }),
115
- destroy: function destroy() {
116
- (0, _destroy2["default"])(window.GSSortableConfigue.instance(componentKey));
117
- },
118
- refresh: function refresh() {
119
- (0, _destroy2["default"])(window.GSSortableConfigue.instance(componentKey));
120
- (0, _init["default"])(window.GSSortableConfigue.instance(componentKey));
81
+ if (window.GSSortableConfigue.references.find(x => x.key === componentKey) === undefined) {
82
+ const currentParams = (0, getCurrentParams_1.default)(params);
83
+ window.GSSortableConfigue.references.push({
84
+ key: componentKey,
85
+ ref: {
86
+ isAddjusting: false,
87
+ grid: gridRef.current,
88
+ currentParams: Object.assign(Object.assign({}, currentParams), { reference: componentKey }),
89
+ destroy: () => {
90
+ var _a;
91
+ (0, destroy_1.default)((_a = window.GSSortableConfigue) === null || _a === void 0 ? void 0 : _a.instance(componentKey));
92
+ },
93
+ refresh: () => {
94
+ var _a, _b;
95
+ (0, destroy_1.default)((_a = window.GSSortableConfigue) === null || _a === void 0 ? void 0 : _a.instance(componentKey));
96
+ (0, init_1.default)((_b = window.GSSortableConfigue) === null || _b === void 0 ? void 0 : _b.instance(componentKey));
97
+ },
98
+ },
99
+ });
100
+ const currentRef = (_a = window.GSSortableConfigue.references.find(x => x.key === componentKey)) === null || _a === void 0 ? void 0 : _a.ref;
101
+ if (params.gsx) {
102
+ const scss = {};
103
+ scss[`[data-key='${componentKey}']`] = Object.assign({}, params.gsx);
104
+ const style = (0, uihelpers_1.convertScssToCss)(scss);
105
+ (0, uihelpers_1.injectCssToHead)(style, componentKey);
106
+ }
107
+ if (currentRef) {
108
+ (0, init_1.default)(currentRef);
109
+ }
121
110
  }
122
- }
123
- });
124
- var currentRef = window.GSSortableConfigue.references.find(function (x) {
125
- return x.key === componentKey;
126
- }).ref;
127
- if (params.gsx != undefined) {
128
- var scss = {};
129
- scss["[data-key='".concat(componentKey, "']")] = _objectSpread({}, params.gsx);
130
- var style = (0, _uihelpers.convertScssToCss)(scss);
131
- (0, _uihelpers.injectCssToHead)(style, componentKey);
111
+ return () => {
112
+ if (window.GSSortableConfigue) {
113
+ window.GSSortableConfigue.references =
114
+ window.GSSortableConfigue.references.filter(x => x.key !== componentKey);
115
+ }
116
+ (0, uihelpers_1.removeCssToHead)(componentKey);
117
+ };
132
118
  }
133
- (0, _init["default"])(currentRef);
134
- }
135
- return function () {
136
- if (window.GSCarouselConfigue != undefined) {
137
- window.GSCarouselConfigue.references = window.GSCarouselConfigue.references.filter(function (x) {
138
- return x.key !== componentKey;
139
- });
119
+ }, [componentKey]);
120
+ (0, react_1.useEffect)(() => {
121
+ setComponentKey(params.reference ? params.reference : (0, uihelpers_1.NewGuid)());
122
+ }, []);
123
+ (0, react_1.useEffect)(() => {
124
+ var _a;
125
+ if (componentKey != null) {
126
+ const ref = (_a = window.GSSortableConfigue) === null || _a === void 0 ? void 0 : _a.instance(componentKey);
127
+ if (ref) {
128
+ ref.refresh();
129
+ }
140
130
  }
141
- (0, _uihelpers.removeCssToHead)(componentKey);
142
- };
143
- }
144
- }, [componentKey]);
145
- (0, _react.useEffect)(function () {
146
- setComponentKey(params.reference != undefined ? params.reference : (0, _uihelpers.NewGuid)());
147
- }, []);
148
- (0, _react.useEffect)(function () {
149
- if (componentKey != null) {
150
- var ref = window.GSSortableConfigue.instance(componentKey);
151
- if (ref !== undefined) {
152
- ref.refresh();
153
- }
154
- }
155
- }, [children]);
156
- return /*#__PURE__*/React.createElement(React.Fragment, null, componentKey != null ? /*#__PURE__*/React.createElement("div", _extends({
157
- className: "gs-sortable-instance gs-sortable-".concat(params.type, " ").concat(rest.className),
158
- ref: gridRef,
159
- "data-key": componentKey
160
- }, Object.fromEntries(Object.entries(_objectSpread({}, rest)).filter(function (_ref2) {
161
- var _ref3 = _slicedToArray(_ref2, 1),
162
- key = _ref3[0];
163
- return !(key in _defaultParams["default"]);
164
- }))), children) : /*#__PURE__*/React.createElement(React.Fragment, null));
131
+ }, [children]);
132
+ return (react_1.default.createElement(react_1.default.Fragment, null, componentKey != null ? (react_1.default.createElement("div", Object.assign({ className: `gs-sortable-instance gs-sortable-${params.type} ${rest.className || ''}`, ref: gridRef, "data-key": componentKey }, Object.fromEntries(Object.entries(Object.assign({}, rest)).filter(([key]) => !(key in defaultParams_1.default)))), children)) : null));
165
133
  };
166
- GSSortable.propTypes = _objectSpread(_objectSpread({}, params), {}, {
167
- responsive: _propTypes["default"].arrayOf(_propTypes["default"].shape({
168
- windowSize: _propTypes["default"].number,
169
- params: _propTypes["default"].shape(_objectSpread({}, params))
170
- }))
171
- });
172
- var _default = exports["default"] = GSSortable;
134
+ exports.default = GSSortable;
135
+ //# sourceMappingURL=GSSortable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GSSortable.js","sourceRoot":"","sources":["../../src/components/GSSortable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAMe;AACf,mFAEqC;AACrC,2DAAmC;AACnC,iEAAyC;AACzC,+EAAuD;AACvD,6EAAqD;AACrD,yEAAiD;AACjD,uEAA+C;AAC/C,mCAAiC;AACjC,oDAK8B;AAsB9B,MAAM,UAAU,GAA8B,CAAC,EAAqB,EAAE,EAAE;QAAzB,EAAE,QAAQ,OAAW,EAAN,IAAI,cAAnB,YAAqB,CAAF;IAChE,MAAM,MAAM,qBAAQ,IAAI,CAAE,CAAC;IAC3B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAC;IAEpD,IAAA,iBAAS,EAAC,GAAG,EAAE;;QACb,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,IAAI,OAAO,MAAM,CAAC,kBAAkB,KAAK,WAAW,EAAE;gBACpD,MAAM,CAAC,kBAAkB,GAAG;oBAC1B,UAAU,EAAE,EAAE;oBACd,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;;wBACxB,IAAI,GAAG,EAAE;4BACP,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,kBAAkB,0CAAE,UAAU,CAAC,IAAI,CACzD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CACnB,CAAC;4BACF,IAAI,QAAQ,EAAE;gCACZ,OAAO,QAAQ,CAAC,GAAG,CAAC;6BACrB;yBACF;oBACH,CAAC;iBACF,CAAC;gBAEF,MAAM,CAAC,gBAAgB,C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OAAO,EAAE,CAAC;aACf;SACF;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,8DACG,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,CACtB,qDACE,SAAS,EAAE,oCAAoC,MAAM,CAAC,IAAI,IACxD,IAAI,CAAC,SAAS,IAAI,EACpB,EAAE,EACF,GAAG,EAAE,OAAO,cACF,YAAY,IAClB,MAAM,CAAC,WAAW,CACpB,MAAM,CAAC,OAAO,mBAAM,IAAI,EAAG,CAAC,MAAM,CAChC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,uBAAa,CAAC,CACnC,CACF,GACA,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,IAAI,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare const constParams: {
2
+ readonly animationSpeed: 400;
3
+ };
4
+ export default constParams;
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var constParams = {
8
- animateionSpeed: 400
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const constParams = {
4
+ animationSpeed: 400, // Fixed typo from "animateionSpeed" to "animationSpeed"
9
5
  };
10
- var _default = exports["default"] = Object.freeze(constParams);
6
+ exports.default = constParams;
7
+ //# sourceMappingURL=constParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constParams.js","sourceRoot":"","sources":["../../src/constants/constParams.tsx"],"names":[],"mappings":";;AAAA,MAAM,WAAW,GAAG;IAClB,cAAc,EAAE,GAAG,EAAE,wDAAwD;CACrE,CAAC;AAEX,kBAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GSSortableProps } from '../components/GSSortable';
2
+ declare const _default: Readonly<Partial<GSSortableProps>>;
3
+ export default _default;
@@ -1,24 +1,23 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _types = _interopRequireDefault(require("./types"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- var defaultParams = {
10
- acceptFrom: [],
11
- className: '',
12
- takeClone: false,
13
- reference: '',
14
- count: 3,
15
- gap: '',
16
- gsx: undefined,
17
- handler: '',
18
- width: 'auto',
19
- type: _types["default"].column,
20
- allowOutOfBox: true,
21
- responsive: [],
22
- afterSort: function afterSort() {}
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
4
  };
24
- var _default = exports["default"] = Object.freeze(defaultParams);
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const types_1 = __importDefault(require("./types"));
7
+ const defaultParams = {
8
+ acceptFrom: [],
9
+ className: '',
10
+ takeClone: false,
11
+ reference: '',
12
+ count: 3,
13
+ gap: '',
14
+ gsx: undefined,
15
+ handler: '',
16
+ width: 'auto',
17
+ type: types_1.default.column,
18
+ allowOutOfBox: true,
19
+ responsive: [],
20
+ afterSort: () => { },
21
+ };
22
+ exports.default = Object.freeze(defaultParams);
23
+ //# sourceMappingURL=defaultParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultParams.js","sourceRoot":"","sources":["../../src/constants/defaultParams.tsx"],"names":[],"mappings":";;;;;AACA,oDAA4B;AAE5B,MAAM,aAAa,GAA6B;IAC9C,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,SAAS;IACd,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,eAAK,CAAC,MAAM;IAClB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;CACpB,CAAC;AAEF,kBAAe,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare const _default: Readonly<{
2
+ row: "row";
3
+ column: "column";
4
+ grid: "grid";
5
+ }>;
6
+ export default _default;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var types = {
8
- row: 'row',
9
- column: 'column',
10
- grid: 'grid'
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const types = {
4
+ row: 'row',
5
+ column: 'column',
6
+ grid: 'grid',
11
7
  };
12
- var _default = exports["default"] = Object.freeze(types);
8
+ exports.default = Object.freeze(types);
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/constants/types.tsx"],"names":[],"mappings":";;AAAA,MAAM,KAAK,GAAG;IACZ,GAAG,EAAE,KAAc;IACnB,MAAM,EAAE,QAAiB;IACzB,IAAI,EAAE,MAAe;CACtB,CAAC;AAEF,kBAAe,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const NewGuid: () => string;
2
+ export declare const removeCssToHead: (key: string) => void;
3
+ export declare const injectCssToHead: (css: string, key: string) => void;
4
+ export declare const convertScssToCss: (scssObj: Record<string, any>) => string;
@@ -1,56 +1,52 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.removeCssToHead = exports.injectCssToHead = exports.convertScssToCss = exports.NewGuid = void 0;
7
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
- var NewGuid = exports.NewGuid = function NewGuid() {
9
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
10
- var r = Math.random() * 16 | 0,
11
- v = c == 'x' ? r : r & 0x3 | 0x8;
12
- return v.toString(16);
13
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertScssToCss = exports.injectCssToHead = exports.removeCssToHead = exports.NewGuid = void 0;
4
+ const NewGuid = () => {
5
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
6
+ const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
7
+ return v.toString(16);
8
+ });
14
9
  };
15
- var removeCssToHead = exports.removeCssToHead = function removeCssToHead(key) {
16
- var style = document.querySelector("head style[data-key='".concat(key, "']"));
17
- if (style != null) {
18
- style.remove();
19
- }
10
+ exports.NewGuid = NewGuid;
11
+ const removeCssToHead = (key) => {
12
+ const style = document.querySelector(`head style[data-key='${key}']`);
13
+ if (style != null) {
14
+ style.remove();
15
+ }
20
16
  };
21
- var injectCssToHead = exports.injectCssToHead = function injectCssToHead(css, key) {
22
- // Create a <style> element
23
- var style = document.createElement('style');
24
- style.dataset.key = key;
25
- // Set the CSS as the inner content of the <style> element
26
- style.innerHTML = css;
27
- // Append the <style> element to the <head>
28
- document.head.appendChild(style);
17
+ exports.removeCssToHead = removeCssToHead;
18
+ const injectCssToHead = (css, key) => {
19
+ // Create a <style> element
20
+ const style = document.createElement('style');
21
+ style.dataset.key = key;
22
+ // Set the CSS as the inner content of the <style> element
23
+ style.innerHTML = css;
24
+ // Append the <style> element to the <head>
25
+ document.head.appendChild(style);
29
26
  };
30
- var camelToKebab = function camelToKebab(str) {
31
- return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
27
+ exports.injectCssToHead = injectCssToHead;
28
+ const camelToKebab = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
29
+ const convertScssToCss = (scssObj) => {
30
+ // Helper function to handle nested objects
31
+ const convertObjectToCss = (obj, parent = '') => {
32
+ let css = '';
33
+ // Iterate over each key-value pair in the SCSS object
34
+ for (let key in obj) {
35
+ const value = obj[key];
36
+ if (typeof value === 'object') {
37
+ // If the value is an object, it's a nested rule, so we recurse
38
+ const newParent = parent ? `${parent} ${key}` : key;
39
+ css += convertObjectToCss(value, newParent); // Recurse and concatenate
40
+ }
41
+ else {
42
+ // Otherwise, it's a property-value pair (e.g. color: red)
43
+ css += `${parent} { ${camelToKebab(key)}: ${value}; }\n`;
44
+ }
45
+ }
46
+ return css;
47
+ };
48
+ // Start recursion with the top-level object
49
+ return convertObjectToCss(scssObj, '');
32
50
  };
33
- var convertScssToCss = exports.convertScssToCss = function convertScssToCss(scssObj) {
34
- // Helper function to handle nested objects
35
- var _convertObjectToCss = function convertObjectToCss(obj) {
36
- var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
37
- var css = '';
38
-
39
- // Iterate over each key-value pair in the SCSS object
40
- for (var key in obj) {
41
- var value = obj[key];
42
- if (_typeof(value) === 'object') {
43
- // If the value is an object, it's a nested rule, so we recurse
44
- var newParent = parent ? "".concat(parent, " ").concat(key) : key;
45
- css += _convertObjectToCss(value, newParent); // Recurse and concatenate
46
- } else {
47
- // Otherwise, it's a property-value pair (e.g. color: red)
48
- css += "".concat(parent, " { ").concat(camelToKebab(key), ": ").concat(value, "; }\n");
49
- }
50
- }
51
- return css;
52
- };
53
-
54
- // Start recursion with the top-level object
55
- return _convertObjectToCss(scssObj, '');
56
- };
51
+ exports.convertScssToCss = convertScssToCss;
52
+ //# sourceMappingURL=uihelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uihelpers.js","sourceRoot":"","sources":["../../src/helpers/uihelpers.tsx"],"names":[],"mappings":";;;AAAO,MAAM,OAAO,GAAG,GAAW,EAAE;IAClC,OAAO,sCAAsC,CAAC,OAAO,CAAC,OA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B,EAAE,EACX,EAAE;QACV,IAAI,GAAG,GAAG,EAAE,CAAC;QAEb,sDAAsD;QACtD,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;YACnB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YAEvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC7B,+DAA+D;gBAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;gBACpD,GAAG,IAAI,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,0BAA0B;aACxE;iBAAM;gBACL,0DAA0D;gBAC1D,GAAG,IAAI,GAAG,MAAM,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC;aAC1D;SACF;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IAEF,4CAA4C;IAC5C,OAAO,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC;AA3BW,QAAA,gBAAgB,oBA2B3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-set/gs-sortable",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Get-Set Sortable",
5
5
  "main": "index.js",
6
6
  "author": "Get-Set",
@@ -10,7 +10,7 @@
10
10
  "dist"
11
11
  ],
12
12
  "scripts": {
13
- "build": "babel src --out-dir dist --copy-files --ignore 'src/**/*.test.js'"
13
+ "build": "tsc"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "react": ">=16.0.0"
@@ -30,6 +30,7 @@
30
30
  "@babel/core": "^7.24.4",
31
31
  "@babel/preset-env": "^7.24.4",
32
32
  "@babel/preset-react": "^7.24.1",
33
+ "@types/react": "^19.1.3",
33
34
  "prettier": "2.7.1"
34
35
  },
35
36
  "dependencies": {