seat-editor 3.3.43 → 3.3.45

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.
@@ -224,60 +224,67 @@ export declare const test1: {
224
224
  sections: any;
225
225
  }[];
226
226
  export declare const test4: ({
227
- x: number;
228
- y: number;
229
- id: number;
230
- fill: string;
231
- tags: ({
232
- gap: string;
233
- key: string;
234
- items: ({
235
- type: string;
236
- value: string;
237
- fontSize: number;
227
+ status: string;
228
+ rsvp: number;
229
+ properties: {
230
+ x: number;
231
+ y: number;
232
+ id: number;
233
+ fill: string;
234
+ tags: ({
235
+ gap: string;
236
+ key: string;
237
+ items: ({
238
+ type: string;
239
+ value: string;
240
+ fontSize: number;
241
+ } | {
242
+ type: string;
243
+ value: string;
244
+ fontSize?: undefined;
245
+ })[];
246
+ direction: string;
247
+ offsetY?: undefined;
248
+ offsetX?: undefined;
238
249
  } | {
239
- type: string;
240
- value: string;
241
- fontSize?: undefined;
250
+ gap: string;
251
+ key: string;
252
+ items: ({
253
+ type: string;
254
+ value: string;
255
+ fontSize: number;
256
+ } | {
257
+ type: string;
258
+ value: string;
259
+ fontSize?: undefined;
260
+ })[];
261
+ direction: string;
262
+ offsetY: number;
263
+ offsetX: number;
242
264
  })[];
243
- direction: string;
244
- offsetY?: undefined;
245
- offsetX?: undefined;
246
- } | {
247
- gap: string;
248
- key: string;
249
- items: ({
250
- type: string;
251
- value: string;
265
+ shape: string;
266
+ width: number;
267
+ height: number;
268
+ labels: {
269
+ x: number;
270
+ y: number;
271
+ label: string;
252
272
  fontSize: number;
253
- } | {
254
- type: string;
255
- value: string;
256
- fontSize?: undefined;
257
- })[];
258
- direction: string;
259
- offsetY: number;
260
- offsetX: number;
261
- })[];
262
- shape: string;
263
- width: number;
264
- height: number;
265
- labels: {
266
- x: number;
267
- y: number;
268
- label: string;
269
- fontSize: number;
270
- fontColor: string;
271
- }[];
272
- opacity: number;
273
- rotation: number;
274
- seatCount: number;
275
- uuid_table: string;
276
- gapTags: number;
277
- status?: undefined;
278
- properties?: undefined;
273
+ fontColor: string;
274
+ }[];
275
+ opacity: number;
276
+ rotation: number;
277
+ seatCount: number;
278
+ uuid_table: string;
279
+ gapTags: number;
280
+ stroke?: undefined;
281
+ strokeWidth?: undefined;
282
+ text?: undefined;
283
+ status?: undefined;
284
+ };
279
285
  } | {
280
286
  status: string;
287
+ rsvp: number;
281
288
  properties: {
282
289
  x: number;
283
290
  y: number;
@@ -331,21 +338,8 @@ export declare const test4: ({
331
338
  opacity: number;
332
339
  rotation: number;
333
340
  seatCount: number;
341
+ uuid_table?: undefined;
334
342
  };
335
- x?: undefined;
336
- y?: undefined;
337
- id?: undefined;
338
- fill?: undefined;
339
- tags?: undefined;
340
- shape?: undefined;
341
- width?: undefined;
342
- height?: undefined;
343
- labels?: undefined;
344
- opacity?: undefined;
345
- rotation?: undefined;
346
- seatCount?: undefined;
347
- uuid_table?: undefined;
348
- gapTags?: undefined;
349
343
  })[];
350
344
  export declare const data4: ({
351
345
  uuid_table: string;
@@ -3364,79 +3364,84 @@ export const test1 = [
3364
3364
  ];
3365
3365
  export const test4 = [
3366
3366
  {
3367
- x: 359.7921676635742,
3368
- y: 109.07066345214844,
3369
- id: 1753965738978,
3370
- fill: "#bca16a",
3371
- tags: [
3372
- {
3373
- gap: "5",
3374
- key: "table",
3375
- items: [
3376
- {
3377
- type: "text",
3378
- value: "VIP 1",
3379
- fontSize: 10,
3380
- },
3381
- {
3382
- type: "icon",
3383
- value: "chair",
3384
- },
3385
- ],
3386
- direction: "column",
3387
- },
3388
- {
3389
- gap: "8",
3390
- key: "pax",
3391
- items: [
3392
- {
3393
- type: "text",
3394
- value: "8/2",
3395
- fontSize: 10,
3396
- },
3397
- {
3398
- type: "icon",
3399
- value: "user",
3400
- },
3401
- ],
3402
- direction: "flex",
3403
- offsetY: 1,
3404
- offsetX: 3,
3405
- },
3406
- {
3407
- gap: "2",
3408
- key: "rsvp_time",
3409
- items: [
3410
- {
3411
- type: "text",
3412
- value: "17:30",
3413
- },
3414
- ],
3415
- direction: "column",
3416
- offsetY: 1,
3417
- offsetX: 3,
3418
- },
3419
- ],
3420
- shape: "square",
3421
- width: 50,
3422
- height: 80,
3423
- labels: [
3424
- {
3425
- x: 0,
3426
- y: 4,
3427
- label: "V 1",
3428
- fontSize: 12,
3429
- fontColor: "#0d0c0c",
3430
- },
3431
- ],
3432
- opacity: 0.5,
3433
- rotation: 0,
3434
- seatCount: 0,
3435
- uuid_table: "d088bba0-e990-410e-aea9-08548175a0b9",
3436
- gapTags: 20,
3367
+ status: "nulls",
3368
+ rsvp: 0,
3369
+ properties: {
3370
+ x: 359.7921676635742,
3371
+ y: 109.07066345214844,
3372
+ id: 1753965738978,
3373
+ fill: "#bca16a",
3374
+ tags: [
3375
+ {
3376
+ gap: "5",
3377
+ key: "table",
3378
+ items: [
3379
+ {
3380
+ type: "text",
3381
+ value: "VIP 1",
3382
+ fontSize: 10,
3383
+ },
3384
+ {
3385
+ type: "icon",
3386
+ value: "chair",
3387
+ },
3388
+ ],
3389
+ direction: "column",
3390
+ },
3391
+ {
3392
+ gap: "8",
3393
+ key: "pax",
3394
+ items: [
3395
+ {
3396
+ type: "text",
3397
+ value: "8/2",
3398
+ fontSize: 10,
3399
+ },
3400
+ {
3401
+ type: "icon",
3402
+ value: "user",
3403
+ },
3404
+ ],
3405
+ direction: "flex",
3406
+ offsetY: 1,
3407
+ offsetX: 3,
3408
+ },
3409
+ {
3410
+ gap: "2",
3411
+ key: "rsvp_time",
3412
+ items: [
3413
+ {
3414
+ type: "text",
3415
+ value: "17:30",
3416
+ },
3417
+ ],
3418
+ direction: "column",
3419
+ offsetY: 1,
3420
+ offsetX: 3,
3421
+ },
3422
+ ],
3423
+ shape: "square",
3424
+ width: 50,
3425
+ height: 80,
3426
+ labels: [
3427
+ {
3428
+ x: 0,
3429
+ y: 4,
3430
+ label: "V 1",
3431
+ fontSize: 12,
3432
+ fontColor: "#0d0c0c",
3433
+ },
3434
+ ],
3435
+ opacity: 0.5,
3436
+ rotation: 0,
3437
+ seatCount: 0,
3438
+ uuid_table: "d088bba0-e990-410e-aea9-08548175a0b9",
3439
+ gapTags: 20,
3440
+ }
3437
3441
  },
3438
3442
  {
3439
- status: "hold",
3443
+ status: "aduhhh",
3444
+ rsvp: 1,
3440
3445
  properties: {
3441
3446
  x: 400,
3442
3447
  y: 20,
@@ -174,21 +174,18 @@ const TouchScrollDetect = () => {
174
174
  key: "rsvp_time",
175
175
  items: ["text", "icon"],
176
176
  },
177
- ], defaultBackground: "#000000", mappingKey: "properties", componentProps: testData === null || testData === void 0 ? void 0 : testData.map((item) => {
178
- return {
179
- properties: item,
180
- test: item === null || item === void 0 ? void 0 : item.test,
181
- };
182
- }), onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
177
+ ], defaultBackground: "#000000", mappingKey: "properties", componentProps: [], onDrop: (e, data) => handleDrop(e, data), onSwitch: (e, data) => handleSwitch(e, data), extraComponentProps: [], onSelectComponent: (component) => {
183
178
  handleSelectTable(component);
184
- },
185
- // dragTableBlockKey={[
186
- // {
187
- // key: "is_lock",
188
- // value: 1,
189
- // },
190
- // ]}
191
- tableMatchKey: [
179
+ }, dragTableBlockKey: [
180
+ {
181
+ key: "status",
182
+ value: null,
183
+ },
184
+ {
185
+ key: "rsvp",
186
+ value: 1
187
+ }
188
+ ], tableMatchKey: [
192
189
  {
193
190
  key: 0,
194
191
  properties: { fill: "white" },
@@ -221,6 +218,6 @@ const TouchScrollDetect = () => {
221
218
  },
222
219
  ], viewStyles: {
223
220
  paddingTop: 200,
224
- }, disabled: false, transformProps: {} })] })] })] }));
221
+ }, transformProps: {} })] })] })] }));
225
222
  };
226
223
  export default TouchScrollDetect;
@@ -198,21 +198,18 @@ const TouchScrollDetect = () => {
198
198
  key: "rsvp_time",
199
199
  items: ["text", "icon"],
200
200
  },
201
- ]} defaultBackground="#000000" mappingKey="properties" componentProps={testData === null || testData === void 0 ? void 0 : testData.map((item) => {
202
- return {
203
- properties: item === null || item === void 0 ? void 0 : item.properties,
204
- test: item === null || item === void 0 ? void 0 : item.test,
205
- };
206
- })} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
201
+ ]} defaultBackground="#000000" mappingKey="properties" componentProps={[]} onDrop={(e, data) => handleDrop(e, data)} onSwitch={(e, data) => handleSwitch(e, data)} extraComponentProps={[]} onSelectComponent={(component) => {
207
202
  handleSelectTable(component);
208
- }}
209
- // dragTableBlockKey={[
210
- // {
211
- // key: "is_lock",
212
- // value: 1,
213
- // },
214
- // ]}
215
- tableMatchKey={[
203
+ }} dragTableBlockKey={[
204
+ {
205
+ key: "status",
206
+ value: null,
207
+ },
208
+ {
209
+ key: "rsvp",
210
+ value: 1
211
+ }
212
+ ]} tableMatchKey={[
216
213
  {
217
214
  key: 0,
218
215
  properties: { fill: "white" },
@@ -245,7 +242,7 @@ const TouchScrollDetect = () => {
245
242
  },
246
243
  ]} viewStyles={{
247
244
  paddingTop: 200,
248
- }} disabled={false} transformProps={{}}/>
245
+ }} transformProps={{}}/>
249
246
  </div>
250
247
  </div>
251
248
  </div>);
@@ -280,7 +280,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
280
280
  }, onMouseLeave: (e) => {
281
281
  const group = e.currentTarget;
282
282
  unhighlightGroup(group);
283
- }, children: _jsxs("g", { transform: `rotate(${rotation}, 0,0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, fill: fill, rx: radius }, omit(item, ["x", "y", "label", "points", "tags"]), commonProps), `${id}-rect`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, pointerEvents: "none", children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
283
+ }, children: _jsxs("g", { transform: `rotate(${rotation}, 0,0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, fill: fill, rx: radius }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]), commonProps), `${id}-rect`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, pointerEvents: "none", children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
284
284
  var _a, _b, _c, _d, _e, _f, _g;
285
285
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
286
286
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -331,7 +331,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
331
331
  }, onMouseLeave: (e) => {
332
332
  const group = e.currentTarget;
333
333
  unhighlightGroup(group);
334
- }, children: [" ", _jsxs("g", { transform: `rotate(${-rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: width / 2, cy: height / 2, r: Math.min(height, width) / 2, fill: fill }, commonProps, omit(item, ["x", "y", "label", "points", "tags"])), id), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
334
+ }, children: [" ", _jsxs("g", { transform: `rotate(${-rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: width / 2, cy: height / 2, r: Math.min(height, width) / 2, fill: fill }, commonProps, omit(item, ["x", "y", "label", "points", "tags", "seatCount"])), id), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
335
335
  var _a, _b, _c, _d, _e, _f, _g;
336
336
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
337
337
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -398,7 +398,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
398
398
  }, onMouseLeave: (e) => {
399
399
  const group = e.currentTarget;
400
400
  unhighlightGroup(group);
401
- }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: tableRadius, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, omit(item, ["x", "y", "label", "points", "tags"]), commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
401
+ }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: centerX, cy: centerY, r: tableRadius, fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]), commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seatCircles.map(({ cx, cy }, i) => (_jsx("circle", { cx: cx, cy: cy, r: seatRadius, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
402
402
  var _a, _b, _c, _d;
403
403
  return (_jsx("text", { x: width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0), y: height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0), fill: (_c = _ === null || _ === void 0 ? void 0 : _.fontColor) !== null && _c !== void 0 ? _c : "black", fontSize: `${(_d = _ === null || _ === void 0 ? void 0 : _.fontSize) !== null && _d !== void 0 ? _d : 10}px`, fontWeight: "bold", textAnchor: "middle", dominantBaseline: "middle", transform: transformRotate, children: _ === null || _ === void 0 ? void 0 : _.label }, `${id}-label-${index}`));
404
404
  }) }))] }) }, id));
@@ -523,7 +523,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
523
523
  }, onMouseLeave: (e) => {
524
524
  const group = e.currentTarget;
525
525
  unhighlightGroup(group);
526
- }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: width / 2, cy: height / 2, r: tableRadius, fill: fill }, omit(item, ["x", "y", "label", "points", "tags"]), commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (_jsx("rect", { x: x, y: y, id: `seat-${id}`, height: height, width: width, rx: radius / 4, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
526
+ }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("circle", Object.assign({ cx: width / 2, cy: height / 2, r: tableRadius, fill: fill }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]), commonProps)), _jsx("g", { "data-seat": `${id}-seats`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (_jsx("rect", { x: x, y: y, id: `seat-${id}`, height: height, width: width, rx: radius / 4, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
527
527
  var _a, _b, _c, _d, _e, _f, _g;
528
528
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
529
529
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -625,7 +625,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
625
625
  }, onMouseLeave: (e) => {
626
626
  const group = e.currentTarget;
627
627
  unhighlightGroup(group);
628
- }, children: _jsxs("g", { transform: `rotate(${rotate}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, omit(item, ["x", "y", "label", "points", "tags"]))), renderTags(tags), _jsx("g", { "data-seat": `${id}-seats`, transform: `translate(${-x}, ${-y})`, children: [...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (_jsx("circle", { id: `seat-${id}`, cx: cx, cy: cy, r: r, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
628
+ }, children: _jsxs("g", { transform: `rotate(${rotate}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height }, commonProps, { fill: selectedTableColor !== null && selectedTableColor !== void 0 ? selectedTableColor : fill }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]))), renderTags(tags), _jsx("g", { "data-seat": `${id}-seats`, transform: `translate(${-x}, ${-y})`, children: [...topSeats, ...bottomSeats, ...leftSeats, ...rightSeats].map(({ cx, cy, id }, i) => (_jsx("circle", { id: `seat-${id}`, cx: cx, cy: cy, r: r, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
629
629
  var _a, _b, _c, _d, _e, _f, _g;
630
630
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
631
631
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -731,7 +731,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
731
731
  }, onMouseLeave: (e) => {
732
732
  const group = e.currentTarget;
733
733
  unhighlightGroup(group);
734
- }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, rx: radius }, commonProps, { fill: fill }, omit(item, ["x", "y", "label", "points", "tags"]))), _jsx("g", { "data-seat": `${id}-seats`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (_jsx("path", { id: `seat-${id}`, d: d, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
734
+ }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, rx: radius }, commonProps, { fill: fill }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]))), _jsx("g", { "data-seat": `${id}-seats`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ d, id }, i) => (_jsx("path", { id: `seat-${id}`, d: d, fill: seatFill, className: item === null || item === void 0 ? void 0 : item.className }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
735
735
  var _a, _b, _c, _d, _e, _f, _g;
736
736
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
737
737
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -861,7 +861,7 @@ const Layers = ({ components, selectedTable, iconTags, eventMatchTable, onHighli
861
861
  }, onMouseLeave: (e) => {
862
862
  const group = e.currentTarget;
863
863
  unhighlightGroup(group);
864
- }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, rx: radius }, commonProps, { fill: fill }, omit(item, ["x", "y", "label", "points", "tags"]))), _jsx("g", { "data-seat": `${id}-seats`, transform: `translate(${-x}, ${-y})`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (_jsx("rect", { x: x, y: y, id: `seat-${id}`, height: height, width: width, rx: radius / 4, fill: seatFill }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
864
+ }, children: _jsxs("g", { transform: `rotate(${rotation}, 0, 0)`, children: [_jsx("rect", Object.assign({ width: width, height: height, rx: radius }, commonProps, { fill: fill }, omit(item, ["x", "y", "label", "points", "tags", "seatCount"]))), _jsx("g", { "data-seat": `${id}-seats`, transform: `translate(${-x}, ${-y})`, children: seats === null || seats === void 0 ? void 0 : seats.map(({ height, width, x, y, id }, i) => (_jsx("rect", { x: x, y: y, id: `seat-${id}`, height: height, width: width, rx: radius / 4, fill: seatFill }, `${id}-seat-${i}`))) }, `${id}-seats`), renderTags(tags), showLabels && (_jsx("g", { transform: `rotate(${-rotation}, ${width / 2}, ${height / 2})`, children: labels === null || labels === void 0 ? void 0 : labels.map((_, index) => {
865
865
  var _a, _b, _c, _d, _e, _f, _g;
866
866
  const cx = width / 2 + ((_a = _ === null || _ === void 0 ? void 0 : _.x) !== null && _a !== void 0 ? _a : 0);
867
867
  const cy = height / 2 + ((_b = _ === null || _ === void 0 ? void 0 : _.y) !== null && _b !== void 0 ? _b : 0);
@@ -13,5 +13,5 @@ interface BoardTemplateProps {
13
13
  };
14
14
  disabled?: boolean;
15
15
  }
16
- declare const BoardTemplate: ({ refs, loadingRender, disabled }: BoardTemplateProps) => React.JSX.Element;
16
+ declare const BoardTemplate: ({ refs, loadingRender, disabled, }: BoardTemplateProps) => React.JSX.Element;
17
17
  export default BoardTemplate;
@@ -15,7 +15,7 @@ import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlo
15
15
  const toolElement = ["square", "circle", "table-seat-circle"];
16
16
  const idSelectionBoxGhost = "selection-box-ghost";
17
17
  const nameShapeSelectionBoxGhost = "selection-box";
18
- const BoardTemplate = ({ refs, loadingRender }) => {
18
+ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
19
19
  const dispatch = useAppDispatch();
20
20
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
21
21
  const selectedComponentProps = useAppSelector((state) => state.panel.selectedComponent);
@@ -1312,7 +1312,7 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1312
1312
  let y2 = [];
1313
1313
  allElementSelectionGroup.forEach((element) => {
1314
1314
  const activeId = element.id;
1315
- const { g, inner, element: el } = getAttributeElement(svg, String(activeId));
1315
+ const { g, inner, element: el, } = getAttributeElement(svg, String(activeId));
1316
1316
  const { x, y, width, height } = getGlobalBBox(svg, g);
1317
1317
  xs.push(x);
1318
1318
  ys.push(y);
@@ -1547,7 +1547,13 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1547
1547
  });
1548
1548
  }
1549
1549
  };
1550
- return (_jsxs(_Fragment, { children: [_jsxs(ModalPreview, { children: [_jsx(LayerView, { statusKey: "status", loadingRender: loadingRender }), _jsx("div", { className: "flex gap-2 mt-2", children: _jsxs(Radio.Group, { value: isShowTagType, onChange: handleCheckPreview, children: [_jsx(Radio, { value: "default", children: "Default" }), _jsx(Radio, { value: "type-1", children: "Type 1" }), _jsx(Radio, { value: "type-2", children: "Type 2" })] }) })] }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden", ref: containerRef, children: [_jsx("div", { className: "absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10", children: _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { icon: _jsx(ZoomIn, {}), onClick: handelZoomIn }), _jsx(Button, { icon: _jsx(ZoomOut, {}), onClick: handleZoomOut })] }) }), _jsx(TransformWrapper, { ref: transformRef,
1550
+ return (_jsxs(_Fragment, { children: [_jsxs(ModalPreview, { children: [_jsx(LayerView, { statusKey: "status", loadingRender: loadingRender, actionPrivileged: {
1551
+ select: false,
1552
+ move: false,
1553
+ switch: false,
1554
+ drop: false,
1555
+ rightClick: false,
1556
+ } }), _jsx("div", { className: "flex gap-2 mt-2", children: _jsxs(Radio.Group, { value: isShowTagType, onChange: handleCheckPreview, children: [_jsx(Radio, { value: "default", children: "Default" }), _jsx(Radio, { value: "type-1", children: "Type 1" }), _jsx(Radio, { value: "type-2", children: "Type 2" })] }) })] }), _jsxs("div", { className: "relative w-full h-screen flex-1 overflow-hidden", ref: containerRef, children: [_jsx("div", { className: "absolute bottom-5 left-1/2 transform -translate-x-1/2 z-10", children: _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { icon: _jsx(ZoomIn, {}), onClick: handelZoomIn }), _jsx(Button, { icon: _jsx(ZoomOut, {}), onClick: handleZoomOut })] }) }), _jsx(TransformWrapper, { ref: transformRef,
1551
1557
  // limitToBounds={true}
1552
1558
  panning: {
1553
1559
  disabled: [
@@ -1558,7 +1564,7 @@ const BoardTemplate = ({ refs, loadingRender }) => {
1558
1564
  "table-seat-circle",
1559
1565
  "table-seat-square",
1560
1566
  "bounding-box",
1561
- ""
1567
+ "",
1562
1568
  ].includes(activeTool),
1563
1569
  },
1564
1570
  // centerZoomedOut={true}
@@ -14,7 +14,7 @@ import { applyResizeToSvgElement, arrayToSvgPointsAttr, createTableGhost, getGlo
14
14
  const toolElement = ["square", "circle", "table-seat-circle"];
15
15
  const idSelectionBoxGhost = "selection-box-ghost";
16
16
  const nameShapeSelectionBoxGhost = "selection-box";
17
- const BoardTemplate = ({ refs, loadingRender, disabled = false }) => {
17
+ const BoardTemplate = ({ refs, loadingRender, disabled = false, }) => {
18
18
  const dispatch = useAppDispatch();
19
19
  const backgroundColor = useAppSelector((state) => state.board.backgroundColor);
20
20
  const selectedComponentProps = useAppSelector((state) => state.panel.selectedComponent);
@@ -1311,7 +1311,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false }) => {
1311
1311
  let y2 = [];
1312
1312
  allElementSelectionGroup.forEach((element) => {
1313
1313
  const activeId = element.id;
1314
- const { g, inner, element: el } = getAttributeElement(svg, String(activeId));
1314
+ const { g, inner, element: el, } = getAttributeElement(svg, String(activeId));
1315
1315
  const { x, y, width, height } = getGlobalBBox(svg, g);
1316
1316
  xs.push(x);
1317
1317
  ys.push(y);
@@ -1548,7 +1548,13 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false }) => {
1548
1548
  };
1549
1549
  return (<>
1550
1550
  <ModalPreview>
1551
- <LayerView statusKey="status" loadingRender={loadingRender} disabled={disabled}/>
1551
+ <LayerView statusKey="status" loadingRender={loadingRender} actionPrivileged={{
1552
+ select: false,
1553
+ move: false,
1554
+ switch: false,
1555
+ drop: false,
1556
+ rightClick: false,
1557
+ }}/>
1552
1558
  <div className="flex gap-2 mt-2">
1553
1559
  <Radio.Group value={isShowTagType} onChange={handleCheckPreview}>
1554
1560
  <Radio value="default">Default</Radio>
@@ -1575,7 +1581,7 @@ const BoardTemplate = ({ refs, loadingRender, disabled = false }) => {
1575
1581
  "table-seat-circle",
1576
1582
  "table-seat-square",
1577
1583
  "bounding-box",
1578
- ""
1584
+ "",
1579
1585
  ].includes(activeTool),
1580
1586
  }}
1581
1587
  // centerZoomedOut={true}
@@ -161,6 +161,12 @@ const TableEditor = (props) => {
161
161
  props === null || props === void 0 ? void 0 : props.defaultBoundingBox,
162
162
  loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
163
163
  ]);
164
- return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative", children: viewOnly ? (_jsx("div", { className: "w-full h-full flex relative", children: _jsx(LayerView, { statusKey: "status", loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`) })) : (_jsxs("div", { className: "w-full h-full flex relative", children: [(loading && !isPreview) && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender }, `${viewOnly}`), _jsx(ControlPanels, { action: props.action, transform: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.transformRef })] }, `${viewOnly}`)) }) }));
164
+ return (_jsx(_Fragment, { children: _jsx("div", { className: "w-full h-screen flex relative", children: viewOnly ? (_jsx("div", { className: "w-full h-full flex relative", children: _jsx(LayerView, { statusKey: "status", loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender, actionPrivileged: {
165
+ select: false,
166
+ move: false,
167
+ switch: false,
168
+ drop: false,
169
+ rightClick: false,
170
+ } }, `${viewOnly}`) })) : (_jsxs("div", { className: "w-full h-full flex relative", children: [loading && !isPreview && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(SideTool, { dragOnly: dragOnly, deleteAutorized: deleteAutorized }), _jsx(Board, { refs: refsBoard, loadingRender: props === null || props === void 0 ? void 0 : props.loadingRender, disabled: props === null || props === void 0 ? void 0 : props.disabledView }, `${viewOnly}`), _jsx(ControlPanels, { action: props.action, transform: (_a = refsBoard === null || refsBoard === void 0 ? void 0 : refsBoard.current) === null || _a === void 0 ? void 0 : _a.transformRef })] }, `${viewOnly}`)) }) }));
165
171
  };
166
172
  export default TableEditor;
@@ -163,9 +163,15 @@ const TableEditor = (props) => {
163
163
  return (<>
164
164
  <div className="w-full h-screen flex relative">
165
165
  {viewOnly ? (<div className="w-full h-full flex relative">
166
- <LayerView key={`${viewOnly}`} statusKey="status" loadingRender={props === null || props === void 0 ? void 0 : props.loadingRender}/>
166
+ <LayerView key={`${viewOnly}`} statusKey="status" loadingRender={props === null || props === void 0 ? void 0 : props.loadingRender} actionPrivileged={{
167
+ select: false,
168
+ move: false,
169
+ switch: false,
170
+ drop: false,
171
+ rightClick: false,
172
+ }}/>
167
173
  </div>) : (<div key={`${viewOnly}`} className="w-full h-full flex relative">
168
- {(loading && !isPreview) && (<div className="absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center">
174
+ {loading && !isPreview && (<div className="absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center">
169
175
  {(loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || <Spin />}
170
176
  </div>)}
171
177
  <SideTool dragOnly={dragOnly} deleteAutorized={deleteAutorized}/>
@@ -6,5 +6,5 @@ interface UploadToolProps {
6
6
  defaultValue?: PropertiesProps;
7
7
  transform?: any;
8
8
  }
9
- declare const UploadTool: ({ name, type, action, defaultValue, transform }: UploadToolProps) => import("react").JSX.Element;
9
+ declare const UploadTool: ({ name, type, action, defaultValue, transform, }: UploadToolProps) => import("react").JSX.Element;
10
10
  export default UploadTool;
@@ -16,7 +16,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
16
16
  import SectionLabel from "../../components/form-tools/label";
17
17
  import SectionShape from "../../components/form-tools/shape";
18
18
  const { Dragger } = Upload;
19
- const UploadTool = ({ name, type, action, defaultValue, transform }) => {
19
+ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
20
20
  // const src = Form.useWatch("src");
21
21
  // const height = Form.useWatch("height");
22
22
  // const width = Form.useWatch("width");
@@ -47,7 +47,7 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
47
47
  const widthWorkspace = ((_b = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientWidth) || 0;
48
48
  const heightWorkspace = ((_c = document === null || document === void 0 ? void 0 : document.getElementById("workspace")) === null || _c === void 0 ? void 0 : _c.clientHeight) || 0;
49
49
  const defaultFormatValue = (width, height, src, id, x, y) => ({
50
- id: String(id) || `${Date.now()}`,
50
+ id: id ? String(id) : `${Date.now()}`,
51
51
  x: x || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionX),
52
52
  y: y || Math.abs(transformState === null || transformState === void 0 ? void 0 : transformState.positionY),
53
53
  width: width < 1 ? 200 : width,
@@ -145,6 +145,6 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
145
145
  const handleDelete = () => {
146
146
  setDefaultSrc(null);
147
147
  };
148
- return (_jsxs(Form.Item, { label: "", name: "src", className: "w-full", children: [defaultSrc ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto", children: _jsx(Image, { src: defaultSrc }) }), _jsx(Button, { type: "primary", onClick: handleDelete, children: "Edit" })] })) : (_jsx(Dragger, Object.assign({ beforeUpload: () => false }, propsUpload, { children: loading ? (_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px]", children: _jsx(LoadingOutlined, {}) })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "ant-upload-drag-icon", children: _jsx(InboxOutlined, {}) }), _jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), _jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] })) }))), _jsx(SectionShape, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }));
148
+ return (_jsxs(Form.Item, { label: "", name: "src", className: "w-full", children: [defaultSrc ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px] overflow-y-auto", children: _jsx(Image, { src: defaultSrc }) }), _jsx(Button, { type: "primary", onClick: handleDelete, children: "Edit" })] })) : (_jsx(Dragger, Object.assign({ beforeUpload: () => false }, propsUpload, { children: loading ? (_jsx("div", { className: "w-full flex flex-col items-center gap-2 max-h-[200px]", children: _jsx(LoadingOutlined, {}) })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "ant-upload-drag-icon", children: _jsx(InboxOutlined, {}) }), _jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }), _jsx("p", { className: "ant-upload-hint", children: "Support for a single or bulk upload. Strictly prohibited from uploading company data or other banned files." })] })) }))), defaultSrc && (_jsxs(_Fragment, { children: [_jsx(SectionShape, { allowChangeShape: type === "component" }), _jsx(SectionLabel, {})] }))] }));
149
149
  };
150
150
  export default UploadTool;
@@ -15,7 +15,7 @@ import { useAppDispatch, useAppSelector } from "../../hooks/use-redux";
15
15
  import SectionLabel from "../../components/form-tools/label";
16
16
  import SectionShape from "../../components/form-tools/shape";
17
17
  const { Dragger } = Upload;
18
- const UploadTool = ({ name, type, action, defaultValue, transform }) => {
18
+ const UploadTool = ({ name, type, action, defaultValue, transform, }) => {
19
19
  // const src = Form.useWatch("src");
20
20
  // const height = Form.useWatch("height");
21
21
  // const width = Form.useWatch("width");
@@ -168,9 +168,10 @@ const UploadTool = ({ name, type, action, defaultValue, transform }) => {
168
168
  </p>
169
169
  </>)}
170
170
  </Dragger>)}
171
-
172
- <SectionShape allowChangeShape={type === "component"}/>
173
- <SectionLabel />
171
+ {defaultSrc && (<>
172
+ <SectionShape allowChangeShape={type === "component"}/>
173
+ <SectionLabel />
174
+ </>)}
174
175
  </Form.Item>);
175
176
  };
176
177
  export default UploadTool;
@@ -77,13 +77,19 @@ export interface LayerViewProps<TMeta = undefined> {
77
77
  paddingRight?: number;
78
78
  paddingBottom?: number;
79
79
  };
80
- disabled?: boolean;
81
80
  loadingRender?: {
82
81
  state: boolean;
83
82
  element: React.JSX.Element;
84
83
  };
85
84
  defaultBoundingBox?: PropertiesProps;
86
85
  viewOnly?: boolean;
86
+ actionPrivileged?: {
87
+ select: boolean;
88
+ move: boolean;
89
+ switch: boolean;
90
+ drop: boolean;
91
+ rightClick: boolean;
92
+ };
87
93
  }
88
94
  declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
89
95
  export default LayerView;
@@ -6,7 +6,13 @@ import Layers from "../../components/layer-v4";
6
6
  import { getTranslate } from "../board-v3/utils";
7
7
  import { Spin } from "antd";
8
8
  const LayerView = (props) => {
9
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled, loadingRender, } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
10
+ select: true,
11
+ move: true,
12
+ switch: true,
13
+ drop: true,
14
+ rightClick: true
15
+ } } = props;
10
16
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
11
17
  const tableGhost = useRef(null);
12
18
  const hoverUnderghostId = useRef(null);
@@ -132,13 +138,13 @@ const LayerView = (props) => {
132
138
  });
133
139
  const rightClick = e.button === 2;
134
140
  const click = e.button === 0;
135
- onRightClick && rightClick && onRightClick(e, find);
136
- onSelectComponent && !rightClick && onSelectComponent(find);
141
+ (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
142
+ (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
137
143
  const seletedTable = mappingKey ? find[mappingKey] : find;
138
144
  setSelectedTable(seletedTable);
139
145
  };
140
146
  const boundingBox = useMemo(() => {
141
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
147
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
142
148
  if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
143
149
  return { minX: 0, minY: 0, width: 500, height: 500 };
144
150
  }
@@ -196,10 +202,10 @@ const LayerView = (props) => {
196
202
  if (hasBoundingBox) {
197
203
  hasBoundingBoxRef.current = true;
198
204
  return {
199
- minX: boundingBoxProps.x,
200
- minY: boundingBoxProps.y,
201
- width: boundingBoxProps.width,
202
- height: boundingBoxProps.height,
205
+ minX: boundingBoxProps.x - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
206
+ minY: boundingBoxProps.y - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
207
+ width: boundingBoxProps.width + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
208
+ height: boundingBoxProps.height + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
203
209
  };
204
210
  }
205
211
  // return {
@@ -210,10 +216,10 @@ const LayerView = (props) => {
210
216
  // };
211
217
  // console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
212
218
  return {
213
- minX: minX - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
214
- minY: minY - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
215
- width: maxX + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
216
- height: maxY + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
219
+ minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
220
+ minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
221
+ width: maxX + (((_o = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _o === void 0 ? void 0 : _o.paddingRight) || 0),
222
+ height: maxY + (((_p = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _p === void 0 ? void 0 : _p.paddingBottom) || 0),
217
223
  };
218
224
  }, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
219
225
  const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
@@ -271,7 +277,7 @@ const LayerView = (props) => {
271
277
  };
272
278
  // drop from out layout editor
273
279
  if (type === "drop") {
274
- onDrop && onDrop(event, data);
280
+ (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
275
281
  }
276
282
  // cari elemen bentuk (rect / circle / path)
277
283
  const shape = group.querySelector("rect") ||
@@ -316,10 +322,10 @@ const LayerView = (props) => {
316
322
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
317
323
  const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
318
324
  ? true
319
- : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
325
+ : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
320
326
  const dataRaw = originalData({ id: ghostId, type: "find" });
321
- return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
- })) && !disabled;
327
+ return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
328
+ }))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
323
329
  if (ghostAttributes) {
324
330
  Object.keys(ghostAttributes).forEach((key) => {
325
331
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -539,15 +545,24 @@ const LayerView = (props) => {
539
545
  }
540
546
  };
541
547
  const hasBoundingBox = hasBoundingBoxRef.current;
548
+ const isValidBoundingBox = Number.isFinite(boundingBox.minX) &&
549
+ Number.isFinite(boundingBox.minY) &&
550
+ Number.isFinite(boundingBox.width) &&
551
+ Number.isFinite(boundingBox.height) &&
552
+ boundingBox.width > 0 &&
553
+ boundingBox.height > 0;
554
+ const viewBox = isValidBoundingBox
555
+ ? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
556
+ : "0 0 1000 1000";
542
557
  return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
543
558
  overflow: "auto",
544
559
  WebkitOverflowScrolling: "touch",
545
560
  } }, props.containerProps, { children: [loading && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%",
546
561
  // scale={5}
547
- overflow: "hidden", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
562
+ overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
548
563
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
549
564
  display: "block",
550
- pointerEvents: disabled ? "none" : "all",
565
+ // pointerEvents: disabled ? "none" : "all",
551
566
  touchAction: "none",
552
567
  userSelect: "none",
553
568
  } }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", "clip-path": "url(#contentCrop)", children: _jsx(Layers, { components: [
@@ -5,7 +5,13 @@ import Layers from "../../components/layer-v4";
5
5
  import { getTranslate } from "../board-v3/utils";
6
6
  import { Spin } from "antd";
7
7
  const LayerView = (props) => {
8
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled = true, loadingRender, } = props;
8
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
9
+ select: true,
10
+ move: true,
11
+ switch: true,
12
+ drop: true,
13
+ rightClick: true
14
+ } } = props;
9
15
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
10
16
  const tableGhost = useRef(null);
11
17
  const hoverUnderghostId = useRef(null);
@@ -131,8 +137,8 @@ const LayerView = (props) => {
131
137
  });
132
138
  const rightClick = e.button === 2;
133
139
  const click = e.button === 0;
134
- onRightClick && rightClick && onRightClick(e, find);
135
- onSelectComponent && !rightClick && onSelectComponent(find);
140
+ (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
141
+ (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
136
142
  const seletedTable = mappingKey ? find[mappingKey] : find;
137
143
  setSelectedTable(seletedTable);
138
144
  };
@@ -270,7 +276,7 @@ const LayerView = (props) => {
270
276
  };
271
277
  // drop from out layout editor
272
278
  if (type === "drop") {
273
- onDrop && onDrop(event, data);
279
+ (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
274
280
  }
275
281
  // cari elemen bentuk (rect / circle / path)
276
282
  const shape = group.querySelector("rect") ||
@@ -315,10 +321,10 @@ const LayerView = (props) => {
315
321
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
316
322
  const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
317
323
  ? true
318
- : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
324
+ : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
319
325
  const dataRaw = originalData({ id: ghostId, type: "find" });
320
- return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
321
- })) && !disabled;
326
+ return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
327
+ }))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
322
328
  if (ghostAttributes) {
323
329
  Object.keys(ghostAttributes).forEach((key) => {
324
330
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -560,7 +566,7 @@ const LayerView = (props) => {
560
566
  overflow="hidden" viewBox={viewBox} className={"h-full"} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
561
567
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
562
568
  display: "block",
563
- pointerEvents: disabled ? "none" : "all",
569
+ // pointerEvents: disabled ? "none" : "all",
564
570
  touchAction: "none",
565
571
  userSelect: "none",
566
572
  }} {...props.svgProps}>
@@ -77,13 +77,19 @@ export interface LayerViewProps<TMeta = undefined> {
77
77
  paddingRight?: number;
78
78
  paddingBottom?: number;
79
79
  };
80
- disabled?: boolean;
81
80
  loadingRender?: {
82
81
  state: boolean;
83
82
  element: React.JSX.Element;
84
83
  };
85
84
  defaultBoundingBox?: PropertiesProps;
86
85
  viewOnly?: boolean;
86
+ actionPrivileged?: {
87
+ select: boolean;
88
+ move: boolean;
89
+ switch: boolean;
90
+ drop: boolean;
91
+ rightClick: boolean;
92
+ };
87
93
  }
88
94
  declare const LayerView: <TMeta>(props: LayerViewProps<TMeta>) => React.JSX.Element;
89
95
  export default LayerView;
@@ -7,7 +7,13 @@ import Layers from "../../components/layer-v4";
7
7
  import { getTranslate } from "../board-v3/utils";
8
8
  import { Spin } from "antd";
9
9
  const LayerView = (props) => {
10
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled = true, loadingRender, } = props;
10
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
11
+ select: true,
12
+ move: true,
13
+ switch: true,
14
+ drop: true,
15
+ rightClick: true
16
+ } } = props;
11
17
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
12
18
  const tableGhost = useRef(null);
13
19
  const hoverUnderghostId = useRef(null);
@@ -93,7 +99,7 @@ const LayerView = (props) => {
93
99
  defaultBackground,
94
100
  loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.state,
95
101
  props === null || props === void 0 ? void 0 : props.viewOnly,
96
- defaultBoundingBox
102
+ defaultBoundingBox,
97
103
  ]);
98
104
  useEffect(() => {
99
105
  setTooltip(Object.assign(Object.assign({}, tooltip), { visible: false }));
@@ -133,13 +139,13 @@ const LayerView = (props) => {
133
139
  });
134
140
  const rightClick = e.button === 2;
135
141
  const click = e.button === 0;
136
- onRightClick && rightClick && onRightClick(e, find);
137
- onSelectComponent && !rightClick && onSelectComponent(find);
142
+ (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
143
+ (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
138
144
  const seletedTable = mappingKey ? find[mappingKey] : find;
139
145
  setSelectedTable(seletedTable);
140
146
  };
141
147
  const boundingBox = useMemo(() => {
142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
148
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
143
149
  if (!componentsEditor && (componentsEditor === null || componentsEditor === void 0 ? void 0 : componentsEditor.length) === 0) {
144
150
  return { minX: 0, minY: 0, width: 500, height: 500 };
145
151
  }
@@ -197,10 +203,10 @@ const LayerView = (props) => {
197
203
  if (hasBoundingBox) {
198
204
  hasBoundingBoxRef.current = true;
199
205
  return {
200
- minX: boundingBoxProps.x,
201
- minY: boundingBoxProps.y,
202
- width: boundingBoxProps.width,
203
- height: boundingBoxProps.height,
206
+ minX: boundingBoxProps.x - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
207
+ minY: boundingBoxProps.y - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
208
+ width: boundingBoxProps.width + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
209
+ height: boundingBoxProps.height + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
204
210
  };
205
211
  }
206
212
  // return {
@@ -211,10 +217,10 @@ const LayerView = (props) => {
211
217
  // };
212
218
  // console.log(minX, minY, maxX, maxY,props?.viewStyles, "bounding box");
213
219
  return {
214
- minX: minX - (((_g = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _g === void 0 ? void 0 : _g.paddingLeft) || 0),
215
- minY: minY - (((_h = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _h === void 0 ? void 0 : _h.paddingTop) || 0),
216
- width: maxX + (((_j = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _j === void 0 ? void 0 : _j.paddingRight) || 0),
217
- height: maxY + (((_k = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _k === void 0 ? void 0 : _k.paddingBottom) || 0),
220
+ minX: minX - (((_l = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _l === void 0 ? void 0 : _l.paddingLeft) || 0),
221
+ minY: minY - (((_m = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _m === void 0 ? void 0 : _m.paddingTop) || 0),
222
+ width: maxX + (((_o = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _o === void 0 ? void 0 : _o.paddingRight) || 0),
223
+ height: maxY + (((_p = props === null || props === void 0 ? void 0 : props.viewStyles) === null || _p === void 0 ? void 0 : _p.paddingBottom) || 0),
218
224
  };
219
225
  }, [componentsEditor, extraComponentsEditor, boundingBoxProps]);
220
226
  const renderElements = (elementEditor, mappingKey, tableMatchKey) => {
@@ -272,7 +278,7 @@ const LayerView = (props) => {
272
278
  };
273
279
  // drop from out layout editor
274
280
  if (type === "drop") {
275
- onDrop && onDrop(event, data);
281
+ (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
276
282
  }
277
283
  // cari elemen bentuk (rect / circle / path)
278
284
  const shape = group.querySelector("rect") ||
@@ -317,10 +323,10 @@ const LayerView = (props) => {
317
323
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
318
324
  const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
319
325
  ? true
320
- : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
326
+ : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
321
327
  const dataRaw = originalData({ id: ghostId, type: "find" });
322
- return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
323
- })) && (!disabled);
328
+ return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
329
+ }))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
324
330
  if (ghostAttributes) {
325
331
  Object.keys(ghostAttributes).forEach((key) => {
326
332
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -346,35 +352,35 @@ const LayerView = (props) => {
346
352
  };
347
353
  const pointerMoveGhost = (ev) => {
348
354
  var _a;
349
- isDragging.current = true;
350
- const p = svg.createSVGPoint();
351
- p.x = ev.clientX;
352
- p.y = ev.clientY;
353
- const dx = ev.clientX - startX;
354
- const dy = ev.clientY - startY;
355
- const distance = Math.sqrt(dx * dx + dy * dy);
356
- onPanning(ev);
357
- if (!hasMoved && distance > 0) {
358
- // transformRef?.current?.instance
359
- // only move ghost if the mouse has moved more than 5 pixels
360
- hasMoved = true;
361
- isDragging.current = true;
362
- }
363
- // ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
364
- ghost.style.display = "none";
365
- const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
366
- ghost.style.display = "";
367
- const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
368
- const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
369
- const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
370
- if (dataHoveredGhostId !== dataGhostId) {
371
- hoverUnderghostId.current = dataHoveredGhostId;
372
- }
373
- const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
374
- // posisi awal ghost di bawah kursor tanpa matrix dulu
375
- const newX = posSVG.x - offset.x;
376
- const newY = posSVG.y - offset.y;
377
355
  if (allowedDrag) {
356
+ isDragging.current = true;
357
+ const p = svg.createSVGPoint();
358
+ p.x = ev.clientX;
359
+ p.y = ev.clientY;
360
+ const dx = ev.clientX - startX;
361
+ const dy = ev.clientY - startY;
362
+ const distance = Math.sqrt(dx * dx + dy * dy);
363
+ onPanning(ev);
364
+ if (!hasMoved && distance > 0) {
365
+ // transformRef?.current?.instance
366
+ // only move ghost if the mouse has moved more than 5 pixels
367
+ hasMoved = true;
368
+ isDragging.current = true;
369
+ }
370
+ // ✅ DETEKSI ELEMEN YANG DILEWATI POINTER
371
+ ghost.style.display = "none";
372
+ const elemUnderPointer = document.elementFromPoint(ev.clientX, ev.clientY);
373
+ ghost.style.display = "";
374
+ const hoveredGroup = elemUnderPointer === null || elemUnderPointer === void 0 ? void 0 : elemUnderPointer.closest("g[data-id]");
375
+ const dataHoveredGhostId = JSON.parse((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.getAttribute("data-id")) || "{}");
376
+ const dataGhostId = JSON.parse(ghost.getAttribute("data-id") || "{}");
377
+ if (dataHoveredGhostId !== dataGhostId) {
378
+ hoverUnderghostId.current = dataHoveredGhostId;
379
+ }
380
+ const posSVG = p.matrixTransform((_a = svg.getScreenCTM()) === null || _a === void 0 ? void 0 : _a.inverse());
381
+ // posisi awal ghost di bawah kursor tanpa matrix dulu
382
+ const newX = posSVG.x - offset.x;
383
+ const newY = posSVG.y - offset.y;
378
384
  ghost.setAttribute("transform", `translate(${newX}, ${newY})`);
379
385
  }
380
386
  };
@@ -427,8 +433,8 @@ const LayerView = (props) => {
427
433
  }
428
434
  if (isDragging.current && hasMoved && allowedDrag) {
429
435
  // drag between group
436
+ console.log("drag between group");
430
437
  const dataHoveredGhost = hoverUnderghostId.current;
431
- hoverUnderghostId.current = null;
432
438
  const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
433
439
  const data = {
434
440
  targetTable: originalData({ id: dataHoveredGhost, type: "find" }),
@@ -440,6 +446,7 @@ const LayerView = (props) => {
440
446
  isDragging.current = false;
441
447
  (_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
442
448
  tableGhost.current = null;
449
+ hoverUnderghostId.current = null;
443
450
  }
444
451
  setPanningGroup(false);
445
452
  tableGhost.current = null;
@@ -540,11 +547,18 @@ const LayerView = (props) => {
540
547
  }
541
548
  };
542
549
  const hasBoundingBox = hasBoundingBoxRef.current;
550
+ const isValidBoundingBox = Number.isFinite(boundingBox.minX) &&
551
+ Number.isFinite(boundingBox.minY) &&
552
+ Number.isFinite(boundingBox.width) &&
553
+ Number.isFinite(boundingBox.height) &&
554
+ boundingBox.width > 0 &&
555
+ boundingBox.height > 0;
556
+ const viewBox = isValidBoundingBox
557
+ ? `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`
558
+ : "0 0 1000 1000";
543
559
  return (_jsxs("div", Object.assign({ className: "relative w-full h-full flex-1", ref: containerRef, style: {
544
560
  overflow: "auto",
545
561
  WebkitOverflowScrolling: "touch",
546
- filter: disabled ? "grayscale(100%)" : "none",
547
- pointerEvents: disabled ? "none" : "auto",
548
562
  } }, props.containerProps, { children: [loading && (_jsx("div", { className: "absolute z-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-opacity-50 bg-white w-full h-full flex items-center justify-center", children: (loadingRender === null || loadingRender === void 0 ? void 0 : loadingRender.element) || _jsx(Spin, {}) })), _jsx(TransformWrapper, Object.assign({ ref: transformRef,
549
563
  // disabled={fingerCount === 1 && scale === 1}
550
564
  disablePadding: true, centerZoomedOut: true, panning: {
@@ -556,20 +570,20 @@ const LayerView = (props) => {
556
570
  width: "100%",
557
571
  height: "100%",
558
572
  // overflow: "visible",
559
- pointerEvents: disabled ? "none" : "auto",
573
+ // pointerEvents: disabled ? "none" : "auto",
560
574
  }, contentStyle: {
561
575
  width: "100%",
562
576
  height: "100%",
563
- pointerEvents: disabled ? "none" : "auto",
577
+ // pointerEvents: disabled ? "none" : "auto",
564
578
  }, children: [_jsxs("svg", Object.assign({ id: "workspace", onContextMenu: (e) => e.preventDefault(), onDrop: (e) => handleTableEvent(e, "drop"), onPointerDown: handlePointerDown, onPointerUp: handleMouseUp, ref: svgRef, width: "100%", height: "100%",
565
579
  // scale={5}
566
- overflow: "hidden", viewBox: `${boundingBox.minX} ${boundingBox.minY} ${boundingBox.width} ${boundingBox.height}`, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
580
+ overflow: "hidden", viewBox: viewBox, className: "h-full", xmlns: "http://www.w3.org/2000/svg", preserveAspectRatio: "xMidYMid meet", style: {
567
581
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
568
582
  display: "block",
569
- pointerEvents: disabled ? "none" : "all",
583
+ // pointerEvents: disabled ? "none" : "all",
570
584
  touchAction: "none",
571
585
  userSelect: "none",
572
- } }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", "clip-path": "url(#contentCrop)", children: _jsx(Layers, { components: [
586
+ } }, props.svgProps, { children: [hasBoundingBox && (_jsx("defs", { children: _jsx("clipPath", { id: "contentCrop", children: _jsx("rect", { x: boundingBox.minX, y: boundingBox.minY, width: boundingBox.width, height: boundingBox.height }) }) })), _jsx("g", { id: "main-layer", clipPath: "url(#contentCrop)", children: _jsx(Layers, { components: [
573
587
  ...extraComponentsEditor,
574
588
  ...renderElements(componentsEditor, mappingKey, tableMatchKey),
575
589
  ], selectedTable: selectedTable, iconTags: iconTags, eventMatchTable: eventMatchTable, privilegedTags: privilegedTags }) })] })), tooltip.visible && (_jsx("div", { className: `seat-editor tooltip-container ${tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className}`, style: Object.assign({ top: tooltip.y, left: tooltip.x, transform: `scale(${1 / scale})`, transformOrigin: "top left", minWidth: widthTooltip + "px" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.style), children: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.children }))] }) }))] })));
@@ -6,7 +6,13 @@ import Layers from "../../components/layer-v4";
6
6
  import { getTranslate } from "../board-v3/utils";
7
7
  import { Spin } from "antd";
8
8
  const LayerView = (props) => {
9
- const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, disabled = true, loadingRender, } = props;
9
+ const { componentProps, extraComponentProps, onSelectComponent, onCurrentStateChange, mappingKey, statusKey, defaultBackground, defaultBoundingBox, iconTags, tooltipProps, onRightClick, allowTooltip = true, tableMatchKey, eventMatchTable, ghostAttributes, onDrop, onSwitch, refs, privilegedTags, loadingRender, actionPrivileged = {
10
+ select: true,
11
+ move: true,
12
+ switch: true,
13
+ drop: true,
14
+ rightClick: true
15
+ } } = props;
10
16
  const widthTooltip = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.minWidth) || 168;
11
17
  const tableGhost = useRef(null);
12
18
  const hoverUnderghostId = useRef(null);
@@ -132,8 +138,8 @@ const LayerView = (props) => {
132
138
  });
133
139
  const rightClick = e.button === 2;
134
140
  const click = e.button === 0;
135
- onRightClick && rightClick && onRightClick(e, find);
136
- onSelectComponent && !rightClick && onSelectComponent(find);
141
+ (onRightClick && rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.rightClick)) && onRightClick(e, find);
142
+ (onSelectComponent && !rightClick && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.select)) && onSelectComponent(find);
137
143
  const seletedTable = mappingKey ? find[mappingKey] : find;
138
144
  setSelectedTable(seletedTable);
139
145
  };
@@ -271,7 +277,7 @@ const LayerView = (props) => {
271
277
  };
272
278
  // drop from out layout editor
273
279
  if (type === "drop") {
274
- onDrop && onDrop(event, data);
280
+ (onDrop && (actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.drop)) && onDrop(event, data);
275
281
  }
276
282
  // cari elemen bentuk (rect / circle / path)
277
283
  const shape = group.querySelector("rect") ||
@@ -316,10 +322,10 @@ const LayerView = (props) => {
316
322
  const ghostId = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
317
323
  const allowedDrag = (!(props === null || props === void 0 ? void 0 : props.dragTableBlockKey)
318
324
  ? true
319
- : (_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
325
+ : !((_a = props === null || props === void 0 ? void 0 : props.dragTableBlockKey) === null || _a === void 0 ? void 0 : _a.some((_) => {
320
326
  const dataRaw = originalData({ id: ghostId, type: "find" });
321
- return _.value != (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
322
- })) && !disabled;
327
+ return _.value === (dataRaw === null || dataRaw === void 0 ? void 0 : dataRaw[_.key]);
328
+ }))) && !(actionPrivileged === null || actionPrivileged === void 0 ? void 0 : actionPrivileged.switch);
323
329
  if (ghostAttributes) {
324
330
  Object.keys(ghostAttributes).forEach((key) => {
325
331
  ghost.setAttribute(key, ghostAttributes[key]);
@@ -426,8 +432,8 @@ const LayerView = (props) => {
426
432
  }
427
433
  if (isDragging.current && hasMoved && allowedDrag) {
428
434
  // drag between group
435
+ console.log("drag between group");
429
436
  const dataHoveredGhost = hoverUnderghostId.current;
430
- hoverUnderghostId.current = null;
431
437
  const sourceTable = JSON.parse(targetGroup.getAttribute("data-id") || "{}");
432
438
  const data = {
433
439
  targetTable: originalData({ id: dataHoveredGhost, type: "find" }),
@@ -439,6 +445,7 @@ const LayerView = (props) => {
439
445
  isDragging.current = false;
440
446
  (_a = tableGhost.current) === null || _a === void 0 ? void 0 : _a.remove();
441
447
  tableGhost.current = null;
448
+ hoverUnderghostId.current = null;
442
449
  }
443
450
  setPanningGroup(false);
444
451
  tableGhost.current = null;
@@ -574,18 +581,18 @@ const LayerView = (props) => {
574
581
  width: "100%",
575
582
  height: "100%",
576
583
  // overflow: "visible",
577
- pointerEvents: disabled ? "none" : "auto",
584
+ // pointerEvents: disabled ? "none" : "auto",
578
585
  }} contentStyle={{
579
586
  width: "100%",
580
587
  height: "100%",
581
- pointerEvents: disabled ? "none" : "auto",
588
+ // pointerEvents: disabled ? "none" : "auto",
582
589
  }}>
583
590
  <svg id="workspace" onContextMenu={(e) => e.preventDefault()} onDrop={(e) => handleTableEvent(e, "drop")} onPointerDown={handlePointerDown} onPointerUp={handleMouseUp} ref={svgRef} width="100%" height="100%"
584
591
  // scale={5}
585
592
  overflow="hidden" viewBox={viewBox} className={"h-full"} xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" style={{
586
593
  background: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : defaultBackground,
587
594
  display: "block",
588
- pointerEvents: disabled ? "none" : "all",
595
+ // pointerEvents: disabled ? "none" : "all",
589
596
  touchAction: "none",
590
597
  userSelect: "none",
591
598
  }} {...props.svgProps}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seat-editor",
3
- "version": "3.3.43",
3
+ "version": "3.3.45",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",