@philipe1993/list-color 1.0.71 → 1.0.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"ListColor.d.ts","sourceRoot":"","sources":["../src/ListColor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AA4B1B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAM5B,CAAC"}
1
+ {"version":3,"file":"ListColor.d.ts","sourceRoot":"","sources":["../src/ListColor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgC1B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAqF5B,CAAC"}
package/dist/ListColor.js CHANGED
@@ -1,8 +1,25 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  exports.ListColor = void 0;
4
18
  var jsx_runtime_1 = require("react/jsx-runtime");
5
19
  var mobx_react_lite_1 = require("mobx-react-lite");
20
+ var colorStore_1 = __importDefault(require("./store/colorStore"));
21
+ var antd_1 = require("antd");
22
+ var icons_1 = require("@ant-design/icons");
6
23
  // BreadCrumb
7
24
  var breadCrumb = [
8
25
  {
@@ -13,6 +30,53 @@ var breadCrumb = [
13
30
  },
14
31
  ];
15
32
  exports.ListColor = (0, mobx_react_lite_1.observer)(function () {
16
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("p", { children: "TESTE" }) }));
33
+ var colorList = colorStore_1.default.colorList, loading = colorStore_1.default.loading, page = colorStore_1.default.page, totalElements = colorStore_1.default.totalElements, defaultparams = colorStore_1.default.defaultparams, sort = colorStore_1.default.sort, size = colorStore_1.default.size;
34
+ var columns = [
35
+ {
36
+ title: 'Código hexadecimal',
37
+ dataIndex: 'hexColorCode',
38
+ key: 'hexColorCode',
39
+ sorter: true,
40
+ render: function (hexColorCode) {
41
+ return ((0, jsx_runtime_1.jsx)(antd_1.ColorPicker, { className: "color-picker-disabled", disabled: true, defaultValue: hexColorCode, showText: function (color) { return (0, jsx_runtime_1.jsxs)("span", { children: ["HEX: ", hexColorCode] }); } }));
42
+ },
43
+ },
44
+ {
45
+ title: 'Nome',
46
+ dataIndex: 'name',
47
+ key: 'name',
48
+ sorter: true,
49
+ },
50
+ {
51
+ title: 'Nome Curto',
52
+ dataIndex: 'shortName',
53
+ key: 'shortName',
54
+ sorter: true,
55
+ },
56
+ {
57
+ title: 'Data de criação',
58
+ dataIndex: 'created',
59
+ key: 'created',
60
+ sorter: true,
61
+ render: function (text) {
62
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("p", { children: text }) }));
63
+ },
64
+ },
65
+ {
66
+ title: 'Editar',
67
+ dataIndex: 'edit',
68
+ key: 'edit',
69
+ align: 'center',
70
+ width: 80,
71
+ render: function (text, record) { return ((0, jsx_runtime_1.jsx)(antd_1.Space, { className: "cursor-pointer", children: (0, jsx_runtime_1.jsx)("a", { href: "/cores/create/".concat(record.uuid), children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(icons_1.EditOutlined, {}) }) }) })); },
72
+ },
73
+ ];
74
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Table, { className: "table-custom", columns: columns, dataSource: colorList.map(function (item, index) { return (__assign(__assign({}, item), { key: item.uuid || index })); }), loading: loading, size: "middle", bordered: false, pagination: {
75
+ current: page + 1,
76
+ pageSize: size,
77
+ total: totalElements,
78
+ showSizeChanger: true,
79
+ pageSizeOptions: ['20', '40', '60'],
80
+ }, showSorterTooltip: { target: 'sorter-icon' } }) }));
17
81
  });
18
82
  //# sourceMappingURL=ListColor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListColor.js","sourceRoot":"","sources":["../src/ListColor.tsx"],"names":[],"mappings":";;;;AAAA,mDAA2C;AAmB3C,aAAa;AACb,IAAM,UAAU,GAAG;IACf;QACI,KAAK,EAAE,8BAAG,IAAI,EAAC,YAAY,0BAAc;KAC5C;IACD;QACI,KAAK,EAAE,8DAAwB;KAClC;CACJ,CAAA;AAEY,QAAA,SAAS,GAAa,IAAA,0BAAQ,EAAC;IACxC,OAAO,CACH,2DACI,kDAAY,GACb,CACN,CAAC;AACN,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"ListColor.js","sourceRoot":"","sources":["../src/ListColor.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,mDAA2C;AAE3C,kEAA4C;AAC5C,6BAAmE;AACnE,2CAAiE;AAmBjE,aAAa;AACb,IAAM,UAAU,GAAG;IACf;QACI,KAAK,EAAE,8BAAG,IAAI,EAAC,YAAY,0BAAc;KAC5C;IACD;QACI,KAAK,EAAE,8DAAwB;KAClC;CACJ,CAAA;AAEY,QAAA,SAAS,GAAa,IAAA,0BAAQ,EAAC;IAChC,IAAA,SAAS,GAA8D,oBAAU,UAAxE,EAAE,OAAO,GAAqD,oBAAU,QAA/D,EAAE,IAAI,GAA+C,oBAAU,KAAzD,EAAE,aAAa,GAAgC,oBAAU,cAA1C,EAAE,aAAa,GAAiB,oBAAU,cAA3B,EAAE,IAAI,GAAW,oBAAU,KAArB,EAAE,IAAI,GAAK,oBAAU,KAAf,CAAgB;IAI1F,IAAM,OAAO,GAA+B;QACxC;YACI,KAAK,EAAE,oBAAoB;YAC3B,SAAS,EAAE,cAAc;YACzB,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,UAAC,YAAY;gBACjB,OAAO,CACH,uBAAC,kBAAW,IACR,SAAS,EAAC,uBAAuB,EACjC,QAAQ,QACR,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,UAAC,KAAK,IAAK,OAAA,sDAAY,YAAY,IAAQ,EAAhC,CAAgC,GACvD,CACL,CAAC;YACN,CAAC;SACJ;QACD;YACI,KAAK,EAAE,MAAM;YACb,SAAS,EAAE,MAAM;YACjB,GAAG,EAAE,MAAM;YACX,MAAM,EAAE,IAAI;SACf;QACD;YACI,KAAK,EAAE,YAAY;YACnB,SAAS,EAAE,WAAW;YACtB,GAAG,EAAE,WAAW;YAChB,MAAM,EAAE,IAAI;SACf;QACD;YACI,KAAK,EAAE,iBAAiB;YACxB,SAAS,EAAE,SAAS;YACpB,GAAG,EAAE,SAAS;YACd,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,UAAC,IAAI;gBACT,OAAO,CACH,2DAAG,wCAAI,IAAI,GAAK,GAAI,CACvB,CAAC;YACN,CAAC;SACJ;QACD;YACI,KAAK,EAAE,QAAQ;YACf,SAAS,EAAE,MAAM;YACjB,GAAG,EAAE,MAAM;YACX,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,UAAC,IAAI,EAAE,MAAM,IAAK,OAAA,CACtB,uBAAC,YAAK,IAAC,SAAS,EAAC,gBAAgB,YAC7B,8BAAG,IAAI,EAAE,wBAAiB,MAAM,CAAC,IAAI,CAAE,YACnC,0CAAK,uBAAC,oBAAY,KAAG,GAAM,GAC3B,GACA,CACX,EANyB,CAMzB;SACJ;KACJ,CAAC;IAGF,OAAO,CACH,2DACI,uBAAC,YAAK,IACF,SAAS,EAAC,cAAc,EACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,UAAC,IAAS,EAAE,KAAa,IAAK,OAAA,uBACjD,IAAI,KACP,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK,IACzB,EAHsD,CAGtD,CAAC,EACH,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,KAAK,EACf,UAAU,EAAE;gBACR,OAAO,EAAE,IAAI,GAAG,CAAC;gBACjB,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,aAAa;gBACpB,eAAe,EAAE,IAAI;gBACrB,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;aACtC,EACD,iBAAiB,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAC9C,GACH,CACN,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare class ColorService {
2
+ getList(params: any): Promise<any>;
3
+ }
4
+ declare const _default: ColorService;
5
+ export default _default;
6
+ //# sourceMappingURL=ColorService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorService.d.ts","sourceRoot":"","sources":["../../src/services/ColorService.ts"],"names":[],"mappings":"AAIA,cAAM,YAAY;IACR,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;CA4C3C;;AAED,wBAAkC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var shared_1 = require("@philipe1993/shared");
40
+ var api = (0, shared_1.getAPIInstance)();
41
+ var ColorService = /** @class */ (function () {
42
+ function ColorService() {
43
+ }
44
+ ColorService.prototype.getList = function (params) {
45
+ return __awaiter(this, void 0, void 0, function () {
46
+ var response, e_1;
47
+ return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0:
50
+ _a.trys.push([0, 2, , 3]);
51
+ return [4 /*yield*/, api.get("".concat(shared_1.URLS.COLORS, "/search"), { params: params })];
52
+ case 1:
53
+ response = _a.sent();
54
+ return [2 /*return*/, response]; // Retorna a resposta da API
55
+ case 2:
56
+ e_1 = _a.sent();
57
+ return [2 /*return*/, { error: "Erro ao trazer listagem" }]; // Retorna um objeto de erro
58
+ case 3: return [2 /*return*/];
59
+ }
60
+ });
61
+ });
62
+ };
63
+ return ColorService;
64
+ }());
65
+ exports.default = new ColorService();
66
+ //# sourceMappingURL=ColorService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorService.js","sourceRoot":"","sources":["../../src/services/ColorService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAA2D;AAC3D,IAAM,GAAG,GAAG,IAAA,uBAAc,GAAE,CAAC;AAE7B;IAAA;IA6CA,CAAC;IA5CS,8BAAO,GAAb,UAAc,MAAW;;;;;;;wBAEA,qBAAM,GAAG,CAAC,GAAG,CAAC,UAAG,aAAI,CAAC,MAAM,YAAS,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;wBAA7D,QAAQ,GAAG,SAAkD;wBACnE,sBAAO,QAAQ,EAAC,CAAC,4BAA4B;;;wBAE7C,sBAAO,EAAE,KAAK,EAAE,yBAAyB,EAAE,EAAC,CAAC,4BAA4B;;;;;KAEhF;IAqCL,mBAAC;AAAD,CAAC,AA7CD,IA6CC;AAED,kBAAe,IAAI,YAAY,EAAE,CAAC"}
@@ -0,0 +1,23 @@
1
+ declare class ColorStore {
2
+ loading: boolean;
3
+ colorList: any[];
4
+ colorSelectList: any;
5
+ sort?: string;
6
+ totalPages: number;
7
+ color: any | undefined;
8
+ page: number;
9
+ totalElements: number;
10
+ size: number;
11
+ defaultparams: {
12
+ size: number;
13
+ page: number;
14
+ sort: string;
15
+ search: string;
16
+ };
17
+ reset(): void;
18
+ constructor();
19
+ getList(params: any): Promise<any>;
20
+ }
21
+ declare const colorStore: ColorStore;
22
+ export default colorStore;
23
+ //# sourceMappingURL=colorStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorStore.d.ts","sourceRoot":"","sources":["../../src/store/colorStore.ts"],"names":[],"mappings":"AAIA,cAAM,UAAU;IACZ,OAAO,EAAE,OAAO,CAAS;IACzB,SAAS,EAAE,GAAG,EAAE,CAAM;IACtB,eAAe,EAAE,GAAG,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAkB;IAC/B,UAAU,EAAE,MAAM,CAAK;IACvB,KAAK,EAAE,GAAG,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAK;IACjB,aAAa,EAAE,MAAM,CAAK;IAC1B,IAAI,EAAE,MAAM,CAAqB;IACjC,aAAa;;;;;MAKZ;IAED,KAAK;;IAUC,OAAO,CAAC,MAAM,EAAE,GAAG;CAkG5B;AAED,QAAA,MAAM,UAAU,YAAmB,CAAC;AACpC,eAAe,UAAU,CAAC"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var shared_1 = require("@philipe1993/shared");
43
+ var mobx_1 = require("mobx");
44
+ var ColorService_1 = __importDefault(require("../services/ColorService"));
45
+ var ColorStore = /** @class */ (function () {
46
+ function ColorStore() {
47
+ this.loading = false;
48
+ this.colorList = [];
49
+ this.sort = 'created,desc';
50
+ this.totalPages = 0;
51
+ this.page = 0;
52
+ this.totalElements = 0;
53
+ this.size = shared_1.DEFAULT_PAGE_SIZE;
54
+ this.defaultparams = {
55
+ size: shared_1.DEFAULT_PAGE_SIZE,
56
+ page: 0,
57
+ sort: 'created,desc',
58
+ search: '',
59
+ };
60
+ (0, mobx_1.makeAutoObservable)(this);
61
+ }
62
+ ColorStore.prototype.reset = function () {
63
+ this.color = undefined;
64
+ this.colorList = [];
65
+ this.colorSelectList = [];
66
+ };
67
+ ColorStore.prototype.getList = function (params) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var response;
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ switch (_a.label) {
73
+ case 0:
74
+ this.loading = true;
75
+ return [4 /*yield*/, ColorService_1.default.getList(params)];
76
+ case 1:
77
+ response = _a.sent();
78
+ (0, mobx_1.runInAction)(function () {
79
+ if (!response.error) {
80
+ _this.colorList = response.data.content;
81
+ _this.totalPages = response.data.totalPages;
82
+ _this.page = response.data.number;
83
+ _this.totalElements = response.data.totalElements;
84
+ _this.size = response.data.size;
85
+ }
86
+ _this.loading = false;
87
+ });
88
+ return [2 /*return*/, response];
89
+ }
90
+ });
91
+ });
92
+ };
93
+ return ColorStore;
94
+ }());
95
+ var colorStore = new ColorStore();
96
+ exports.default = colorStore;
97
+ //# sourceMappingURL=colorStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorStore.js","sourceRoot":"","sources":["../../src/store/colorStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwD;AACxD,6BAAuD;AACvD,0EAAoD;AAEpD;IAuBI;QAtBA,YAAO,GAAY,KAAK,CAAC;QACzB,cAAS,GAAU,EAAE,CAAC;QAEtB,SAAI,GAAY,cAAc,CAAC;QAC/B,eAAU,GAAW,CAAC,CAAC;QAEvB,SAAI,GAAW,CAAC,CAAC;QACjB,kBAAa,GAAW,CAAC,CAAC;QAC1B,SAAI,GAAW,0BAAiB,CAAC;QACjC,kBAAa,GAAG;YACZ,IAAI,EAAE,0BAAiB;YACvB,IAAI,EAAE,CAAC;YACP,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,EAAE;SACb,CAAA;QASG,IAAA,yBAAkB,EAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IARD,0BAAK,GAAL;QACI,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC9B,CAAC;IAMK,4BAAO,GAAb,UAAc,MAAW;;;;;;;wBACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;wBACH,qBAAM,sBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,EAAA;;wBAA7C,QAAQ,GAAG,SAAkC;wBAEnD,IAAA,kBAAW,EAAC;4BACR,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gCAClB,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;gCACvC,KAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;gCAC3C,KAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;gCACjC,KAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;gCACjD,KAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;4BACnC,CAAC;4BACD,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;wBACzB,CAAC,CAAC,CAAC;wBAEH,sBAAO,QAAQ,EAAC;;;;KACnB;IAkFL,iBAAC;AAAD,CAAC,AA7HD,IA6HC;AAED,IAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AACpC,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface Color {
2
+ uuid: string;
3
+ created?: string;
4
+ modified?: string;
5
+ active?: boolean;
6
+ deleted?: boolean;
7
+ hexColorCode: string;
8
+ name: string;
9
+ shortName: string;
10
+ }
11
+ //# sourceMappingURL=Color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../src/types/Color.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Color.js","sourceRoot":"","sources":["../../src/types/Color.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@philipe1993/list-color",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
7
7
  "build": "tsc"
8
8
  },
9
9
  "dependencies": {
10
- "react": "^18.3.1",
11
- "mobx-react-lite": "^4.0.7"
10
+ "@philipe1993/shared": "^1.0.31",
11
+ "mobx-react-lite": "^4.0.7",
12
+ "react": "^18.3.1"
12
13
  },
13
14
  "devDependencies": {
14
15
  "typescript": "^5.6.2"
package/src/ListColor.tsx CHANGED
@@ -1,5 +1,9 @@
1
1
  import { observer } from 'mobx-react-lite';
2
2
  import React from 'react';
3
+ import colorStore from './store/colorStore';
4
+ import { ColorPicker, Space, Table, TableColumnsType } from 'antd';
5
+ import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
6
+
3
7
 
4
8
  interface DataType {
5
9
  active: boolean;
@@ -28,9 +32,88 @@ const breadCrumb = [
28
32
  ]
29
33
 
30
34
  export const ListColor: React.FC = observer(() => {
35
+ const { colorList, loading, page, totalElements, defaultparams, sort, size } = colorStore;
36
+
37
+
38
+
39
+ const columns: TableColumnsType<DataType> = [
40
+ {
41
+ title: 'Código hexadecimal',
42
+ dataIndex: 'hexColorCode',
43
+ key: 'hexColorCode',
44
+ sorter: true,
45
+ render: (hexColorCode) => {
46
+ return (
47
+ <ColorPicker
48
+ className="color-picker-disabled"
49
+ disabled
50
+ defaultValue={hexColorCode}
51
+ showText={(color) => <span>HEX: {hexColorCode}</span>}
52
+ />
53
+ );
54
+ },
55
+ },
56
+ {
57
+ title: 'Nome',
58
+ dataIndex: 'name',
59
+ key: 'name',
60
+ sorter: true,
61
+ },
62
+ {
63
+ title: 'Nome Curto',
64
+ dataIndex: 'shortName',
65
+ key: 'shortName',
66
+ sorter: true,
67
+ },
68
+ {
69
+ title: 'Data de criação',
70
+ dataIndex: 'created',
71
+ key: 'created',
72
+ sorter: true,
73
+ render: (text) => {
74
+ return (
75
+ <>{<p>{text}</p>}</>
76
+ );
77
+ },
78
+ },
79
+ {
80
+ title: 'Editar',
81
+ dataIndex: 'edit',
82
+ key: 'edit',
83
+ align: 'center',
84
+ width: 80,
85
+ render: (text, record) => (
86
+ <Space className="cursor-pointer">
87
+ <a href={`/cores/create/${record.uuid}`}>
88
+ <div><EditOutlined /></div>
89
+ </a>
90
+ </Space>
91
+ ),
92
+ },
93
+ ];
94
+
95
+
31
96
  return (
32
97
  <>
33
- <p>TESTE</p>
98
+ <Table
99
+ className="table-custom"
100
+ columns={columns}
101
+ dataSource={colorList.map((item: any, index: number) => ({
102
+ ...item,
103
+ key: item.uuid || index,
104
+ }))}
105
+ loading={loading}
106
+ size="middle"
107
+ bordered={false}
108
+ pagination={{
109
+ current: page + 1,
110
+ pageSize: size,
111
+ total: totalElements,
112
+ showSizeChanger: true,
113
+ pageSizeOptions: ['20', '40', '60'],
114
+ }}
115
+ showSorterTooltip={{ target: 'sorter-icon' }}
116
+ />
34
117
  </>
35
118
  );
36
119
  });
@@ -0,0 +1,52 @@
1
+
2
+ import { getAPIInstance, URLS } from "@philipe1993/shared";
3
+ const api = getAPIInstance();
4
+
5
+ class ColorService {
6
+ async getList(params: any): Promise<any> {
7
+ try {
8
+ const response = await api.get(`${URLS.COLORS}/search`, { params });
9
+ return response; // Retorna a resposta da API
10
+ } catch (e) {
11
+ return { error: "Erro ao trazer listagem" }; // Retorna um objeto de erro
12
+ }
13
+ }
14
+
15
+ // async createColor(color: any): Promise<any> {
16
+ // try {
17
+ // const response = await api.post(`${URLS.COLORS}`, color);
18
+ // return response; // Retorna a resposta da API
19
+ // } catch (error) {
20
+ // return { error: "Erro ao cadastrar", details: error }; // Retorna um objeto de erro
21
+ // }
22
+ // }
23
+
24
+ // async editColor(color: any, uuid: string | undefined): Promise<any> {
25
+ // try {
26
+ // const response = await api.put(`${URLS.COLORS}/${uuid}`, color);
27
+ // return response; // Retorna a resposta da API
28
+ // } catch (error) {
29
+ // return { error: "Erro ao cadastrar", details: error }; // Retorna um objeto de erro
30
+ // }
31
+ // }
32
+
33
+ // async getColorByUuid(uuid: any): Promise<any> {
34
+ // try {
35
+ // const response = await api.get(`${URLS.COLORS}/${uuid}`);
36
+ // return response; // Retorna a resposta da API
37
+ // } catch (e) {
38
+ // return { error: "Erro ao buscar dados" }; // Retorna um objeto de erro
39
+ // }
40
+ // }
41
+
42
+ // async deleteColor(uuid: any): Promise<any> {
43
+ // try {
44
+ // const response = await api.delete(`${URLS.COLORS}/${uuid}`);
45
+ // return response; // Retorna a resposta da API
46
+ // } catch (e) {
47
+ // return { error: "Erro ao deletar" }; // Retorna um objeto de erro
48
+ // }
49
+ // }
50
+ }
51
+
52
+ export default new ColorService();
@@ -0,0 +1,133 @@
1
+ import { DEFAULT_PAGE_SIZE } from "@philipe1993/shared";
2
+ import { makeAutoObservable, runInAction } from 'mobx';
3
+ import ColorService from '../services/ColorService';
4
+
5
+ class ColorStore {
6
+ loading: boolean = false;
7
+ colorList: any[] = [];
8
+ colorSelectList: any;
9
+ sort?: string = 'created,desc';
10
+ totalPages: number = 0;
11
+ color: any | undefined;
12
+ page: number = 0;
13
+ totalElements: number = 0;
14
+ size: number = DEFAULT_PAGE_SIZE;
15
+ defaultparams = {
16
+ size: DEFAULT_PAGE_SIZE,
17
+ page: 0,
18
+ sort: 'created,desc',
19
+ search: '',
20
+ }
21
+
22
+ reset() {
23
+ this.color = undefined;
24
+ this.colorList = [];
25
+ this.colorSelectList = [];
26
+ }
27
+
28
+ constructor() {
29
+ makeAutoObservable(this);
30
+ }
31
+
32
+ async getList(params: any) {
33
+ this.loading = true;
34
+ const response = await ColorService.getList(params);
35
+
36
+ runInAction(() => {
37
+ if (!response.error) {
38
+ this.colorList = response.data.content;
39
+ this.totalPages = response.data.totalPages;
40
+ this.page = response.data.number;
41
+ this.totalElements = response.data.totalElements;
42
+ this.size = response.data.size;
43
+ }
44
+ this.loading = false;
45
+ });
46
+
47
+ return response;
48
+ }
49
+
50
+ // async createColor(color: any) {
51
+ // this.loading = true;
52
+ // const response = await ColorService.createColor(color);
53
+
54
+ // runInAction(() => {
55
+ // if (response.error) {
56
+ // message.error(response?.details?.response?.data?.message);
57
+ // this.color = color;
58
+ // } else {
59
+ // message.success('Cor cadastrado com sucesso!');
60
+ // }
61
+ // this.loading = false;
62
+ // });
63
+
64
+ // return response;
65
+ // }
66
+
67
+ // async editColor(color: any, uuid: string | undefined) {
68
+ // this.loading = true;
69
+ // const response = await ColorService.editColor(color, uuid);
70
+
71
+ // runInAction(() => {
72
+ // if (response.error) {
73
+ // message.error(response?.details?.response?.data?.message);
74
+ // this.color = color;
75
+ // } else {
76
+ // message.success('Cor editado com sucesso!');
77
+ // }
78
+ // this.loading = false;
79
+ // });
80
+
81
+ // return response;
82
+ // }
83
+
84
+ // async getColorByUuid(uuid: string) {
85
+ // this.loading = true;
86
+ // const response = await ColorService.getColorByUuid(uuid);
87
+
88
+ // runInAction(() => {
89
+ // if (response.error) {
90
+ // message.error('Erro ao buscar Cor');
91
+ // return;
92
+ // }
93
+ // this.color = response.data;
94
+ // this.loading = false;
95
+ // });
96
+
97
+ // return response;
98
+ // }
99
+
100
+ // async deleteColor(uuid: string) {
101
+ // this.loading = true;
102
+ // const response = await ColorService.deleteColor(uuid);
103
+
104
+ // runInAction(() => {
105
+ // if (response.error) {
106
+ // message.error('Erro ao deletar Cor');
107
+ // } else {
108
+ // message.success('Cor deletado com sucesso!');
109
+ // this.color = undefined;
110
+ // }
111
+ // this.loading = false;
112
+ // });
113
+
114
+ // return response;
115
+ // }
116
+
117
+ // async deleteColorAll(uuid: string) {
118
+ // this.loading = true;
119
+ // const response = await ColorService.deleteColor(uuid);
120
+
121
+ // runInAction(() => {
122
+ // if (!response.error) {
123
+ // this.color = undefined;
124
+ // }
125
+ // this.loading = false;
126
+ // });
127
+
128
+ // return response;
129
+ // }
130
+ }
131
+
132
+ const colorStore = new ColorStore();
133
+ export default colorStore;
package/tsconfig.json CHANGED
@@ -1,19 +1,23 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES5", // Compatibilidade ampla
4
- "module": "CommonJS", // Módulos compatíveis com Node.js/NPM
5
- "jsx": "react-jsx", // Processa arquivos JSX no formato moderno
4
+ "module": "CommonJS", // Formato de módulos para Node.js/NPM
5
+ "jsx": "react-jsx", // Processamento de JSX para React
6
6
  "outDir": "./dist", // Diretório de saída
7
7
  "rootDir": "./src", // Diretório de entrada
8
- "declaration": true, // Gera arquivos .d.ts para os tipos
9
- "declarationMap": true, // Gera mapas para os arquivos de tipos
8
+ "declaration": true, // Gera arquivos de definição de tipos (.d.ts)
9
+ "declarationMap": true, // Gera mapas para arquivos de definição de tipos
10
10
  "sourceMap": true, // Gera mapas para depuração
11
11
  "esModuleInterop": true, // Compatibilidade com módulos ES
12
- "skipLibCheck": true // Ignora verificações em dependências externas
12
+ "skipLibCheck": true, // Ignora verificações em dependências externas
13
+ "lib": [
14
+ "ES2015",
15
+ "DOM"
16
+ ] // Adiciona suporte para Promises e APIs do navegador
13
17
  },
14
18
  "include": [
15
19
  "src/**/*"
16
- ], // Inclui arquivos na pasta src
20
+ ], // Inclui arquivos da pasta src
17
21
  "exclude": [
18
22
  "node_modules",
19
23
  "dist"
@@ -1,55 +0,0 @@
1
-
2
- import URLS from '../../shared/src/config/urls';
3
- import { getAPIInstance } from "@philipe1993/shared";
4
-
5
-
6
- const api = getAPIInstance();
7
-
8
- class ColorService {
9
- async getList(params: any): Promise<any> {
10
- try {
11
- const response = await api.get(`${URLS.COLORS}/search`, { params });
12
- return response; // Retorna a resposta da API
13
- } catch (e) {
14
- return { error: "Erro ao trazer listagem" }; // Retorna um objeto de erro
15
- }
16
- }
17
-
18
- async createColor(color: any): Promise<any> {
19
- try {
20
- const response = await api.post(`${URLS.COLORS}`, color);
21
- return response; // Retorna a resposta da API
22
- } catch (error) {
23
- return { error: "Erro ao cadastrar", details: error }; // Retorna um objeto de erro
24
- }
25
- }
26
-
27
- async editColor(color: any, uuid: string | undefined): Promise<any> {
28
- try {
29
- const response = await api.put(`${URLS.COLORS}/${uuid}`, color);
30
- return response; // Retorna a resposta da API
31
- } catch (error) {
32
- return { error: "Erro ao cadastrar", details: error }; // Retorna um objeto de erro
33
- }
34
- }
35
-
36
- async getColorByUuid(uuid: any): Promise<any> {
37
- try {
38
- const response = await api.get(`${URLS.COLORS}/${uuid}`);
39
- return response; // Retorna a resposta da API
40
- } catch (e) {
41
- return { error: "Erro ao buscar dados" }; // Retorna um objeto de erro
42
- }
43
- }
44
-
45
- async deleteColor(uuid: any): Promise<any> {
46
- try {
47
- const response = await api.delete(`${URLS.COLORS}/${uuid}`);
48
- return response; // Retorna a resposta da API
49
- } catch (e) {
50
- return { error: "Erro ao deletar" }; // Retorna um objeto de erro
51
- }
52
- }
53
- }
54
-
55
- export default new ColorService();
@@ -1,135 +0,0 @@
1
- import { message } from 'antd';
2
- import { makeAutoObservable, runInAction } from 'mobx';
3
- import { Color } from '../types/Color';
4
- import ColorService from '../services/ColorService';
5
- import { DEFAULT_PAGE_SIZE } from "@philipe1993/shared";
6
-
7
- class ColorStore {
8
- loading: boolean = false;
9
- colorList: Color[] = [];
10
- colorSelectList: any;
11
- sort?: string = 'created,desc';
12
- totalPages: number = 0;
13
- color: Color | undefined;
14
- page: number = 0;
15
- totalElements: number = 0;
16
- size: number = DEFAULT_PAGE_SIZE;
17
- defaultparams = {
18
- size: DEFAULT_PAGE_SIZE,
19
- page: 0,
20
- sort: 'created,desc',
21
- search: '',
22
- }
23
-
24
- reset() {
25
- this.color = undefined;
26
- this.colorList = [];
27
- this.colorSelectList = [];
28
- }
29
-
30
- constructor() {
31
- makeAutoObservable(this);
32
- }
33
-
34
- async getList(params: any) {
35
- this.loading = true;
36
- const response = await ColorService.getList(params);
37
-
38
- runInAction(() => {
39
- if (!response.error) {
40
- this.colorList = response.data.content;
41
- this.totalPages = response.data.totalPages;
42
- this.page = response.data.number;
43
- this.totalElements = response.data.totalElements;
44
- this.size = response.data.size;
45
- }
46
- this.loading = false;
47
- });
48
-
49
- return response;
50
- }
51
-
52
- async createColor(color: Color) {
53
- this.loading = true;
54
- const response = await ColorService.createColor(color);
55
-
56
- runInAction(() => {
57
- if (response.error) {
58
- message.error(response?.details?.response?.data?.message);
59
- this.color = color;
60
- } else {
61
- message.success('Cor cadastrado com sucesso!');
62
- }
63
- this.loading = false;
64
- });
65
-
66
- return response;
67
- }
68
-
69
- async editColor(color: Color, uuid: string | undefined) {
70
- this.loading = true;
71
- const response = await ColorService.editColor(color, uuid);
72
-
73
- runInAction(() => {
74
- if (response.error) {
75
- message.error(response?.details?.response?.data?.message);
76
- this.color = color;
77
- } else {
78
- message.success('Cor editado com sucesso!');
79
- }
80
- this.loading = false;
81
- });
82
-
83
- return response;
84
- }
85
-
86
- async getColorByUuid(uuid: string) {
87
- this.loading = true;
88
- const response = await ColorService.getColorByUuid(uuid);
89
-
90
- runInAction(() => {
91
- if (response.error) {
92
- message.error('Erro ao buscar Cor');
93
- return;
94
- }
95
- this.color = response.data;
96
- this.loading = false;
97
- });
98
-
99
- return response;
100
- }
101
-
102
- async deleteColor(uuid: string) {
103
- this.loading = true;
104
- const response = await ColorService.deleteColor(uuid);
105
-
106
- runInAction(() => {
107
- if (response.error) {
108
- message.error('Erro ao deletar Cor');
109
- } else {
110
- message.success('Cor deletado com sucesso!');
111
- this.color = undefined;
112
- }
113
- this.loading = false;
114
- });
115
-
116
- return response;
117
- }
118
-
119
- async deleteColorAll(uuid: string) {
120
- this.loading = true;
121
- const response = await ColorService.deleteColor(uuid);
122
-
123
- runInAction(() => {
124
- if (!response.error) {
125
- this.color = undefined;
126
- }
127
- this.loading = false;
128
- });
129
-
130
- return response;
131
- }
132
- }
133
-
134
- const colorStore = new ColorStore();
135
- export default colorStore;
File without changes